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
liraira [26]
3 years ago
8

CPS 2231: Computer Organization and Programming Programming assignment #1 Concepts: Scanner, loops, input validation, array, met

hods Point value: 100 points Due date: as noted on blackboard Assignment: Write a program that asks the user to enter today’s sales for five stores. The program should then display a bar chart comparing each store’s sales. Create each bar in the bar chart by displaying a row or asterisks. Each asterisk should represent $100 of sales. You must use a loop to print the bar chart. If the user enters a negative value for the sales amount, the program will keep asking the user to enter the sales amount until a positive amount is entered
Engineering
1 answer:
agasfer [191]3 years ago
3 0

Answer:

import java.util.*;

public class BarChart

{

public static void main(String args[])

{

int arr[]=new int[5];

Scanner sc=new Scanner(System.in);

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

{

while(true){

System.out.println("Enter today's sale for store "+(i+1)+" (negative value not allowed)");

arr[i]=sc.nextInt();  

if(arr[i]>0)

break;

}

}

System.out.println("SALES BAR CHART");

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

{

System.out.println("Store "+(i+1)+": ");

for(int j=0;j<arr[i];j=j+100)

{  

System.out.print("*");

}

System.out.println("");

}

}

}

You might be interested in
A rigid bar pendulum is attached to a cart, which moves along the horizontal plane. The rigid bar has a center of mass at L/2. T
Vikentia [17]

Answer:

See the attached picture for answer.

Explanation:

See the attached picture for explanation.

4 0
3 years ago
A rigid tank contains 3 kg of water initially at 43.97% quality and at a temperature of 120°C. The water is heated until it reac
makkiz [27]

Explanation: see attachment below

6 0
3 years ago
An electric dipole is made of two charges of equal magnitudes and opposite signs. The positive charge, q=1.0 μC, is located at t
vfiekz [6]

Answer:

work done by electric field  is 0.06 J

Explanation:

Given data:

Two point charge is + 1\mu C  and -1 \mu C

0+1 charge positioned is (0 cm , 1 cm, 0.00 cm)

-1 charge positioned is (0 cm , -1 cm, 0.00 cm)

E = 3.0\times 10^6 N/C

From above information, the distance between  given two charges d = 2 cm

then d = 0.02m

 work needed is W = q E d

W = 1.0 \times 10^{-6} \times 3.0 \times 10^6 \times 0.02

W = 0.06 J  

Therefore work done by electric field  is 0.06 J

8 0
3 years ago
Using a pressure transducer and lab scope is a similar process to using a pressure gauge- true/false
MariettaO [177]

Answer:

true

Explanation:

4 0
3 years ago
If a PPE doesn’t fit properly do you keep wearing them
masha68 [24]
What is that lol? Ensuring
7 0
3 years ago
Read 2 more answers
Other questions:
  • The ratio of the weight of a substance to the weight of equal volume of water is known as a) Density b) specific gravity c) spec
    8·1 answer
  • With increases in magnification, which of the following occur? a. The field of view decreases. b. The ambient illumination decre
    9·1 answer
  • Carnot heat engine A operates between 20ºC and 520ºC. Carnot heat engine B operates between 20ºC and 820ºC. Which Carnot heat en
    5·1 answer
  • Input signal to a controller is​
    9·1 answer
  • A common rule of thumb for controller discretization is to have "6 samples per rise time" in order to achieve a reasonable appro
    9·1 answer
  • While discussing VIN numbers, Technician A says that the first digit of the VIN identifies the country where the vehicle was man
    15·1 answer
  • An ideal reheat Rankine cycle with water as the working fluid operates the boiler at 15,000 kPa, the reheater at 2000 kPa, and t
    13·1 answer
  • 12. A structural component is fabricated from an alloy that has a plane strain fracture toughness of It has been determined that
    11·1 answer
  • I) A sag vertical curve is to be designed to join a 4% grade to a 2% grade. If the design
    6·1 answer
  • Use the map to answer the question.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!