Help me with these Java Programming problems: Thank you Write a program that dis
ID: 2247183 • Letter: H
Question
Help me with these Java Programming problems:
Thank you
Write a program that displays Welcome to Java, Welcome to Computer Science, and Programming is fun. (Compute expressions) Write a program that displays the result of 9.5 times 4.5 - 2.5 times 3/45.5 - 3.5 (Approximate pi) pi can be computed using the following formula: pi = 4 times (1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 +) Write a program that displays the result of 4 times (1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11) and 4 times (1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13). Use 1 0 instead of 1 in your program. (Area and perimeter of a rectangle) Write a program that displays the area and perimeter of a rectangle with a width of 4.5 and a height of 7.9 using the following formula: area = width times heightExplanation / Answer
1.1)
public class DisplayMesg {
public static void main(String[] args) {
//Displaying the Messages
System.out.println("Welcome to Java.");
System.out.println("Welcome to Computer science.");
System.out.println("Programming is fun.");
}
}
_________________
Output
Welcome to Java.
Welcome to Computer science.
Programming is fun.
___________________
1.5)
Compute.java
public class Compute {
public static void main(String[] args) {
double res = (9.5 * 4.5 - 2.5 * 3) / (45.5 - 3.5);
System.out.printf("Result : %.2f", res);
}
}
__________________
1.9)
Rectangle.java
public class Rectangle {
public static void main(String[] args) {
//Declaring variables
double width = 4.5, height = 7.9;
double perimeter, area;
//Computing area and perimeter of the rectangle
area = width * height;
perimeter = 2 * (width + height);
//Displaying the area and perimeter of the rectangle
System.out.printf("Area of the rectangle : %.2f ", area);
System.out.println("Perimeter of the rectangle :" + perimeter);
}
}
_________________
Output:
Area of the rectangle : 35.55
Perimeter of the rectangle :24.8
_________________Thank You
I will do 1.7 also
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.