Ask Question

an online retailter sells two products: widgets and gizmos each widget weighs 75 grams. each gizmo weighs 112 grams. write a program the reads the numbers of widgets and the number of gizmos in an order from th user the your program should compute and discplay the total weight of the order

+4
Answers (1)
  1. 30 April, 01:10
    0
    import java. util.*;

    public class OnlineSell {

    public static void main (String [] args) {

    Scanner input = new Scanner (System. in);

    double total = 0;

    System. out. print ("Enter the number of widgets: ");

    int widgets = input. nextInt ();

    System. out. print ("Enter the number of gizmos: ");

    int gizmos = input. nextInt ();

    total = (widgets * 75) + (gizmos * 112);

    System. out. println ("The total weight of the order is: " + total + " grams");

    }

    }

    Explanation:

    - Ask the user to enter the number of widgets and gizmos

    - Calculate the total weight by multiplying the numbers of widgets with 75 and the number of gizmos with 112, and summing these two values

    - Print the total
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “an online retailter sells two products: widgets and gizmos each widget weighs 75 grams. each gizmo weighs 112 grams. write a program the ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers