Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. You have several pictures of different sizes that you would like to frame. A

ID: 3706458 • Letter: 1

Question

1.

You 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. Supose 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 outpu the cost of framing the picture:

a. the length and width, in inches, of the picture.

b. the type of 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.

3. Write a program tht reads a set of integers, and then finds and prints the sum of the even and odd integers

Subject: java programming

Explanation / Answer

import java.util.*;

public class CheggQ1 {

public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner sc = new Scanner(System.in);

System.out.println("Enter the length of the frame");

int l = sc.nextInt();

System.out.println("Enter the width of the frame");

int w = sc.nextInt();

System.out.println("Enter the type of frame you want");

System.out.println("Press F for Fancy and R for Regular");

char type = sc.next().charAt(0);

System.out.println("Enter the colour of the frame");

String colour = sc.next();

System.out.println("Do you want Crowns");

System.out.println("Press Y for YES,N for NO");

char choice = sc.next().charAt(0);

int crownno=0;

if(choice=='Y') {

System.out.println("How many crowns do you want");

crownno = sc.nextInt();

}

int colouringprice = (w*2)+(l+2)*2;

double framecost=0;

if(type=='F' || type=='f') {

framecost = colouringprice*0.25;

}

else if(type=='R' || type=='r'){

framecost = colouringprice*0.15;

}

double cardboardcost = l*w*0.02;

double glasscost = l*w*0.07;

double crowncost=0;

if(choice=='Y' || choice=='y') {

crowncost = crownno*0.35;

}

double ans =

colouringprice+framecost+cardboardcost+glasscost+crowncost;

System.out.println("The cost of framin is: "+ans);

}

}