Respuesta :
Answer:
written in java
Note : Package name was excluded
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//declared 8 uninitialised variable
String input;
double cost, colorC, frameC, paperC, glassC, crownC;
char crowns;
int type, color, crown, length, width, area, perimeter;
//creating an instance of the Scanner class to accept value from user
Scanner scanner = new Scanner(System.in);
System.out.print("Enter length of frame: ");
length = scanner.nextInt();
System.out.print("Enter width of frame: ");
width = scanner.nextInt();
System.out.print("Do you want a fancy frame or a regular frame\nEnter 1 for fancy, 2 for regular: ");
type = scanner.nextInt();
if (type == 1) {
frameC = 0.25;
} else {
frameC = 0.15;
}
System.out.print("Do you want a white frame or a colored frame\nEnter 1 for white, 2 for colored: ");
color = scanner.nextInt();
if (color == 2) {
colorC = .10;
} else{
colorC = 0;
}
System.out.print("Do you want crowns \nEnter y for yes, n for no ");
input = scanner.next();
crowns = input.charAt(0);
if (crowns == 'y' || crowns == 'Y') {
System.out.print("How many crowns?");
crown = scanner.nextInt();
} else
crown = 0;
if (crown > 0)
crownC = crown * .35;
else
crownC = 0;
area = length * width;
perimeter = length * 2 + width * 2;
paperC = area * .02;
glassC = area * .07;
cost = glassC + paperC + crownC + colorC * perimeter + frameC * perimeter;
System.out.println("The cost of your frame is: $" + cost);
}
}