Answer to Question #230500 in Java | JSP | JSF for arz

Question #230500
  1. have several pictures of different sizes that you would like to frame. A local picture framing store offers two types of frames—regular and fancy. The frames are available in white and can be ordered in any color the customer desires. Suppose that each frame is 1 inch wide. The cost of coloring the frame is $0.10 per inch. The cost of a regular frame is $0.15 per inch and the cost of a fancy frame is $0.25 per inch. The cost of putting a cardboard paper behind the picture is $0.02 per square inch and the cost of putting glass on top of the picture is $0.07 per square inch. The customer can also choose to put crowns on the corners, which costs $0.35 per crown. Write a program that prompts the user to input the following information and then output the cost of framing the picture: 

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. 


1
Expert's answer
2021-08-30T01:35:58-0400
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);
	
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS