Unit 5 Lesson 2 Coding Activity 1: import java.util.Scanner; public class U5_L2_Activity_One{ public static void monthName(int x) { switch(x) { case 1:System.out.println("January"); break; case 2:System.out.println("February"); break;case 3:System.out.println("March"); break;case 4:System.out.println("April"); break;case 5:System.out.println("May"); break;case 6:System.out.println("June"); break;case 7:System.out.println("July"); break;case 8:System.out.println("August"); break;case 9:System.out.println("September"); break;case 10:System.out.println("October"); break;case 11:System.out.println("November"); break;default:System.out.println("December"); } } } Unit 5 Lesson 2 Coding Activity 2: import java.util.Scanner; public class U5_L2_Activity_Two { public static void reverser(String x) { for(int i=x.length()-1;i>=0;i--) { System.out.print(x.charAt(i)); } } } Unit 5 Lesson 2 Coding Activity 3: import java.util.Scanner; public class U5_L2_Activity_Three { public static void swap(int x,double y) { System.out.print(y+" "+x); } } Unit 5 Lesson 2 Coding Activity 4: import java.util.Scanner; public class U5_L2_Activity_Four { public static void realTime(int x) { System.out.printf("Hours: %d\nMinutes: %d\nSeconds: %d",(x/3600),(x/60-(x/3600)*60),(x%60)); } } Hope this helps! public class RightTriangle //field public RightTriangle() { //Creates a right triangle with base of bs and height of ht if these are positive. If either is not positive, set the length of that side to 1.0.
//set height //methods public void setBase(double bs) public void setHeight(double ht) public double getHeight() { //Calculates the perimeter of this right triangle as a double. //Compares this right triangle to the other. The result is true if and only if the base and height of this right triangle are equal to the base and height respectively of the other right triangle. //A String representation of this right triangle. This is in the form "right triangle with base a, height b, hypotenuse c", where a, b and c are the doubles representing the base, height and hypotenuse of the right triangle. } Follower Tracker codingMASTER398 A global leader board of the follower counts of Replit users, with growth rates and predictions! 6.2K 156 84 #apps +4 Blocky Tower DarekCCC Target of this game is to stack tetris-like blocks as long as you can. Game ends if one of blocks fall down. No more rules. Game is using KaboomJS with MatterJS. Use spacebar or UP arrow to rotate blocks. 41.2K 292 657 #games +4 Fendorea IroncladDev Share, create, discuss AI-generated images on the stable diffusion engine! Let's make this the most-liked repl ever 😉 4.6K 101 149 #games +4 |