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

Write a program that produces a sales report for a salsa maker who markets 5 typ

ID: 3765031 • Letter: W

Question

Write a program that produces a sales report for a salsa maker who markets 5 types of salsa ("mild ", "medium", "sweet ", "hot ", "zesty "). The program includes total sales for all products and identifies the highest and lowest selling product (Assuming each jar is $4). It generates a report: Name Jars Sold _______________________ Mild 10 Medium 20 . . . At the end of this report it will show below items: Total sales: High Seller: Low Seller: Two parallel arrays are used to store the salsa names (Mild, Medium, etc.) and quantities sold of each (prompt user).

Explanation / Answer

import java.util.Scanner;

public class SalesReport {

   public static void main(String[] args) {
       // TODO Auto-generated method stub
       String salsaTypes[] = { "mild ", "medium", "sweet", "hot ", "zesty " };
       int totalSales[] = new int[5];
       int totalAllSales = 0, highestSale = 0, minSale = 0;
       Scanner scanner = new Scanner(System.in);
       try {
           for (int i = 0; i < 5; i++) {

               System.out
                       .print("Quantaties Sold for -" + salsaTypes[i] + " :");

               totalSales[i] = scanner.nextInt();
               if (i == 0) {
                   minSale = totalSales[0];

               }
               totalAllSales += totalSales[i];
               if (highestSale < totalSales[i]) {
                   highestSale = totalSales[i];
               }
               if (minSale > totalSales[i]) {
                   minSale = totalSales[i];
               }

           }
           System.out.println("Name Jars Sold");
           for (int i = 0; i < 5; i++) {

               System.out.println(salsaTypes[i] + " " + totalSales[i]);
           }
           System.out.println("Total sales :" + totalAllSales);
           System.out.println(" High Seller :" + highestSale);
           System.out.println("Low Seller :" + minSale);

       } catch (Exception e) {
       }

   }

}

OUTPUT:

Quantaties Sold for -mild :7
Quantaties Sold for -medium :6
Quantaties Sold for -sweet :8
Quantaties Sold for -hot :5
Quantaties Sold for -zesty :9
Name    Jars Sold
mild        7
medium       6
sweet       8
hot        5
zesty        9

Total sales :35
High Seller :9
Low Seller :5

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