a. The length and width, in inches, of the picture.
b. The type of the frame.
c. Customer’s choice of color to color the frame.
d. If the user wants to add the crowns, then the number of crowns.
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
// The length and width, in inches, of the picture.
int length, width;
Scanner in =new Scanner(System.in);
System.out.println("Enter length:");
length=in.nextInt();
System.out.println("Enter width: ");
width=in.nextInt();
//The type of the frame.
String type;
System.out.println("Enter type of frame, regular/fancy: ");
type=in.next();
//Customer’s choice of color to color the frame.
String color;
System.out.println("Enter color: ");
color=in.next();
//If the user wants to add the crowns, then the number of crowns.
int crowns;
System.out.println("Enter number of crowns: ");
crowns=in.nextInt();
double total_cost;
double t_cost=0;
if (type=="regular")
t_cost=0.15;
else if (type=="fancy")
t_cost=0.25;
total_cost=t_cost+(width*0.10)+(0.02*(length*width))+(0.07*(length*width))+(crowns*0.35);
System.out.println("The cost of framing the picture is: "+total_cost);
}
}
Comments
Leave a comment