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
An exit sign must be:Colored in a way that doesn’t attract attentionIlluminated by a reliable light sourceAt least 3 inches tall
Ksenya-84 [330]

Answer:

Red

Explanation:

5 0
3 years ago
Which element of Miranda's character is best illustrated by this excerpt?
Iteru [2.4K]

Answer:

B. She is compassionate

Explanation:

6 0
3 years ago
Leland wants to work in a Production career operating heavy machinery. Which type of education or training should Leland seek?
zhenek [66]

Answer:

it is indeed C

Explanation:

4 0
3 years ago
Read 2 more answers
IM JI Suneou uo mm
Oksi-84 [34.3K]

Answer: g

Explanation:

5 0
3 years ago
Windmills slow the air and cause it to fill a larger channel as it passes through the blades. Consider a circular windmill with
Scilla [17]

Answer:

DIAMETER  = 9.797 m

POWER = \dot W = 28.6 kW

Explanation:

Given data:

circular windmill diamter D1 = 8m

v1 = 12 m/s

wind speed = 8 m/s

we know that specific volume is given as

v =\frac{RT}{P}

  where v is specific volume of air

considering air pressure is 100 kPa and temperature 20 degree celcius

v =  \frac{0.287\times 293}{100}

v = 0.8409 m^3/ kg

from continuity equation

A_1 V_1 = A_2 V_2

\frac{\pi}{4}D_1^2 V_1 = \frac{\pi}{4}D_1^2 V_2

D_2 = D_1 \sqrt{\frac{V_1}{V_2}}

D_2 = 8 \times \sqrt{\frac{12}{8}}

D_2 = 9.797 m

mass flow rate is given as

\dot m = \frac{A_1 V_1}{v} = \frac{\pi 8^2\times 12}{4\times 0.8049}

\dot m = 717.309 kg/s

the power produced \dot W = \dot m \frac{ V_1^2 - V_2^2}{2} = 717.3009 [\frac{12^2 - 8^2}{2} \times \frac{1 kJ/kg}{1000 m^2/s^2}]

\dot W = 28.6 kW

8 0
3 years ago
Other questions:
  • Thermal energy generated by the electrical resistance of a 5-mm-diameter and 4-m-long bare cable is dissipated to the surroundin
    12·1 answer
  • Consider a single crystal of some hypothetical metal that has the BCC crystal structure and is oriented such that a tensile stre
    10·1 answer
  • Why is it a good idea to lock your doors while driving?<br> WRITER
    10·1 answer
  • What kind of value should an employee possess when employees are expected to be responsible and fair?
    5·1 answer
  • Which of these is shown in the animation below?
    6·1 answer
  • Select the correct answer.
    6·1 answer
  • Describe the role of C-S-H in providing strength for cement. Discuss which compounds produce C-S-H and why balancing the amounts
    13·1 answer
  • Agricultural economics is a study of how agriculture and business are related.<br> False<br> True
    15·1 answer
  • ​please how to drawing mechanical drawing after connecting the all parts thanks
    6·1 answer
  • Suppose a manager of a certain mining company wants to determine the weekly food expenditure of the company’s employees. if ther
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!