1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mario62 [17]
3 years ago
14

Write a program that lets a maker of chips and salsa keep track of sales for five different types of salsa: mild, medium, sweet,

hot, and zesty. The program should use two parallel 5-element arrays: an array of strings that holds the five salsa names and an array of integers that holds the number of jars sold during the past month for each salsa type. The salsa names should be stored using an initialization list at the time the name array is created. The program should prompt the user to enter the number of jars sold for each type. Once this sales data has been entered, the program should produce a report that displays sales for each salsa type, total sales, and the names of the highest selling and lowest selling products.
Computers and Technology
1 answer:
jok3333 [9.3K]3 years ago
4 0

Answer:

The program in Java is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 String [] salsa = {"Mild","Medium","Sweet","Hot","Zesty"};

 int [] number = new int[5];

 for(int i = 0;i<5;i++){

     System.out.print(salsa[i]+" number: ");

     number[i] = input.nextInt();

 }

 for(int i = 0;i<5;i++){

     System.out.println(salsa[i]+" : "+number[i]);

 }

 int smallest = number[0];  int highest = number[0];

 int count = 0;

 for(int i = 0;i<5;i++){

     if(smallest > number[i]){

         smallest = number[i];

         count = i;

     }

 }

 System.out.println("Smallest");

 System.out.println(salsa[count]+" : "+smallest);

    for(int i = 0;i<5;i++){

     if(highest < number[i]){

         highest = number[i];

         count = i;

     }

 }

 System.out.println("Highest");

 System.out.println(salsa[count]+" : "+highest);

}

}

Explanation:

This initializes the salsa names

 String [] salsa = {"Mild","Medium","Sweet","Hot","Zesty"};

This declares the array for the amount of salsa

 int [] number = new int[5];

This iterates through the 5 salsas and get input for the amount of each

<em>  for(int i = 0;i<5;i++){</em>

<em>      System.out.print(salsa[i]+" number: ");</em>

<em>      number[i] = input.nextInt();</em>

<em>  }</em>

This prints each salsa and the amount sold

<em>  for(int i = 0;i<5;i++){</em>

<em>      System.out.println(salsa[i]+" : "+number[i]);</em>

<em>  }</em>

This initializes smallest and largest to the first array element

 int smallest = number[0];  int highest = number[0];

This initializes the index of the highest or lowest to 0

 int count = 0;

The following iteration gets the smallest of the array elements

<em>  for(int i = 0;i<5;i++){</em>

<em>      if(smallest > number[i]){</em>

<em>          smallest = number[i];</em>

This gets the index of the smallest

<em>          count = i;</em>

<em>      }</em>

<em>  }</em>

This prints the smallest

<em>  System.out.println("Smallest");</em>

<em>  System.out.println(salsa[count]+" : "+smallest);</em>

The following iteration gets the largest of the array elements    

<em>for(int i = 0;i<5;i++){</em>

<em>      if(highest < number[i]){</em>

<em>          highest = number[i];</em>

This gets the index of the highest

<em>          count = i;</em>

<em>      }</em>

<em>  }</em>

This prints the highest

 System.out.println("Highest");

 System.out.println(salsa[count]+" : "+highest);

You might be interested in
Which of these field types allows multiple, non-exclusive options?
AlexFokin [52]

Question:

Which of these field types allows multiple, non-exclusive options?

A. multi-part

B. checkbox

C. text

D. radio button

E. button

Answer:

The correct option is B) Checkboxes

Explanation:

Field types is a terminology often associated with Database Management.

A field type is often found in a data collection apparatus such a form. It's inherent quality or nature will determine the kind of data that it can collect.

Some field types allow for exclusive options. That is, in some data field types, it's impossible to select more than one option.

For example, a Button field type can only collect one type of value.

A Checkbox on the other can be configured to allow for multiple selections which may or may not be exclusive.

When working with Microsoft Access, for instance, you are required to select the name of the <em>field </em>and define the type of <em>field data.</em>

<em />

Cheers!

6 0
2 years ago
Any device that performs single conversion is ____​
andrew-mc [135]

Answer:

modulator

Explanation:

A modulator is a device that performs modulation.

(Single conversation)

5 0
2 years ago
The shipping charges per 500 miles are not prorated. For example, if a 2-pound package is shipped 550 miles, the charges would b
Sedbober [7]

Answer:

The solution code is written in Python:

  1. COST_PER_500MI = 1.1
  2. weight = float(input("Enter weight of package: "))
  3. total_cost = weight * COST_PER_500MI
  4. print("The shipping charges is $" + str(round(total_cost,2)))

Explanation:

Based on the information given in the question, we presume the cost per 500 miles is $1.10 per pound ($2.20 / 2 pound).

Create a variable COST_PER_500MI to hold the value of cost per 500 miles (Line 1). Next, prompt user input the weight and assign it to variable weight (Line 3). Calculate the shipping charge and display it using print function (Line 4-5).

4 0
3 years ago
What can we do to positive interaction online?
Julli [10]

Answer:

We can help eachother out with things.

Explanation:

Eg. Schoolwork and homework because our stress level will decrease.

8 0
2 years ago
Read 2 more answers
Who does car shows in gta 5 or what do you guys do in gta
grandymaker [24]

Answer:

google can find u some discord servers

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • At the beginning of this month, the balance of Reed's checking account was $692.35. So far this month, he has received a paychec
    13·2 answers
  • How do i cancel my brainly premium account?
    14·2 answers
  • What is the output of the following program?
    9·1 answer
  • 6.5 Code Practice: Question 1 please help with code!!! Thank you
    12·1 answer
  • The Mark Table of Contents Entry option is used for marking nonheading text for the table of contents. the options are manually
    5·2 answers
  • Jenn wants to assign a value to the favorite car variable: favoriteCar = Toyota but gets an error message. What does she need to
    11·1 answer
  • Which symbol would be used in a flowchart to represent a connection to another part of the flowchart
    5·1 answer
  • Currently, this program will add 6 and 3 together, output the math problem and output the answer. Edit this code so that a rando
    9·1 answer
  • How do you modify WordArt? Give specific details and steps<br><br> NEED THIS ASAP
    9·1 answer
  • listen to exam instructions a small business called widgets, inc. has hired you to evaluate their wireless network security prac
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!