Program1.java
import java.util.Scanner;
public class Program1 {
public static void main(String args[]){
Scanner sc = new
Scanner(System.in);
int length;
double radius;
System.out.print("Enter the radius
and length of a cylinder: ");
radius = sc.nextDouble();
length = sc.nextInt();
double area = Math.PI * radius *
radius;
System.out.println("The area is
"+area);
double volume = area *
length;
System.out.println("The Volume is
"+volume);
}
}
Program2.java
import java.util.Scanner;
public class Program2 {
public static void main(String args[]){
Scanner sc = new
Scanner(System.in);
System.out.format("%-10s%-30s%-10s\n",
"ID","Description","Rate");
System.out.format("%-10s%-30s%-10s\n", "K","Kabsa",13.5f);
System.out.format("%-10s%-30s%-10s\n", "L","Laham
Mandi",49f);
System.out.format("%-10s%-30s%-10s\n", "M","Mazghut",17.5f);
System.out.println();
System.out.println("Enter your
response: ");
char response =
sc.nextLine().charAt(0);
if(response == 'k' ||
Character.toUpperCase(response) == 'K'){
System.out.println("Your bill for Kabsa is ");
System.out.println();
System.out.println("KABSA - 13.5");
System.out.println("VAT(5%) - "+13.5*0.05);
System.out.println("---------------------------------");
System.out.println("Total - "+(13.5+(13.5*0.05))+" SAR");
}else if(response == 'l' ||
Character.toUpperCase(response) == 'L'){
System.out.println("Your bill for Laham Mandi is ");
System.out.println();
System.out.println("LAHAM MANDI - 49");
System.out.println("VAT(5%) - "+49*0.05);
System.out.println("---------------------------------");
System.out.println("Total - "+(49+(49*0.05))+" SAR");
}else if(response == 'm' ||
Character.toUpperCase(response) == 'M'){
System.out.println("Your bill for Mazghut is ");
System.out.println();
System.out.println("MAZGHUT - 17.5");
System.out.println("VAT(5%) - "+17.5*0.05);
System.out.println("---------------------------------");
System.out.println("Total - "+(17.5+(17.5*0.05))+" SAR");
}
}
}
OOLSVIEW 215710514 (ratected View) Wo CTED VIEW Beca 1. Write a program that reads in the...
The statement in the following program is in the incorrect order. Rearrange the statements so that they prompt the user to input the shape type (rectangle, circle, or cylinder) and the appropriate dimension of the shape. The program then outputs the following information about the shape: For a rectangle, it outputs the area and perimeter, for a circle, it outputs the area and circumference; and for a cylinder, it output the volume and surface area. After rearranging the statements, your...
Please help me to write a program in C++ with comments and to
keep it simple as possible.
Thank you!
Here is my program I have done before and that need
to be change:
#include <iostream>
#include <iomanip>
using namespace std;
// function prototype – returning one value
double cylvol(double, double); // Note: two data types inside
brackets
double surfarea(double, double); // Note: two data types inside
brackets
int main()
{
double r, l, V, S;
cout << setprecision(2) <<...
Need in C++
Assignment #1: Write a program to ask the user for a sphere radius r as a double. Then compute and display the sphere surface area using S-4*PI'r*r as double. Then compute and display the sphere volume using V-(1.33)*PIr'r*r as double. Use: const double PI-3.14;
I'm trying to write a program that can ask a user about what type of solid they have and to be able to enter values like radius and length of the shape so the program can calculate the volume of a shape and print the result. I also want to give them a repeating option to input another shape if they want to. I'm trying to use at least 7 functions that can display an output, the volumes of a...
iIn python please
AutoSave H L04-3b Testing Lab - Protected View - Saved to this PC- Search A Jharrah375@outlook.com J 7 File Home Insert Draw Design Layout Share Comments References Mailings Review View Help Areas and Volumes We'll write a program that prompts the user for a radius and then prints: a) The area and circumference of a circle with that radius b) The volume and surface area of a sphere with that radius 1. To get started, what is...