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

caitlyn\'s crafty creations computes a retail price for eac product as the cost

ID: 3662915 • Letter: C

Question

caitlyn's crafty creations computes a retail price for eac product as the cost of materials plus $12 multiplied by the number of hours of work required to create the product, plus $7 shipping and handling. Create a class that contains a main () method that prompts the user for the name of a product (for example, "woven purse"), the cost of materials, and the number of hours of work required. Pass the numeric data to a method that computes the retail price of the product and returns the computed value to the main() method where the product name and price are displayed.

Explanation / Answer

import java.lang.*;
import java.util.Scanner;

public class Compute{
    int retailvalue(int cost_of_material,int hours)
    {
        return cost_of_material+hours*12+7;//return cost of mateial plus $12 multified for hours plus &7 to handle  
    }

     public static void main(String []args){
        int cost,hours,i=1;
        String name;
        Compute a=new Compute();
        Scanner con=new Scanner(System.in);
        while(i!=0){
        System.out.println("enter product name");
       
        name=con.next();
       System.out.println("enter cost of materials");
        cost=con.nextInt();
        System.out.println("enter number of hours required");
       hours=con.nextInt();
        int retail=a.retailvalue(cost,hours);
        System.out.println("product name="+name+" retail cost is $"+retail);
        System.out.println("if u want to continue for next product press 1 else 0");
        i=con.nextInt();
     }
     }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote