Ask Question
25 June, 05:06

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

+3
Answers (1)
  1. 25 June, 05:21
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers