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 horizontal curve of a two-lane undivided highway (12-foot lanes) has a radius of 678 feet to the center line of the roadway. A
OLEGan [10]

Answer:

maximum speed for safe vehicle operation = 55mph

Explanation:

Given data :

radius ( R ) = 678 ft

old building located ( m )= 30 ft

super elevation = 0.06

<u>Determine the maximum speed for safe vehicle operation </u>

firstly calculate the stopping sight distance

m = R ( 1 - cos \frac{28.655*S}{R} )  ----  ( 1 )

R = 678  

m ( horizontal sightline ) = 30 ft

back to equation 1

30 = 678 ( 1 - cos (28.655 *s / 678 ) )

( 1 - cos (28.655 *s / 678 ) )  = 30 / 678 = 0.044

cos \frac{28.65 *s }{678}  = 1.044

hence ; 28.65 * s = 678 * 0.2956

s = 6.99 ≈ 7 ft

next we will calculate the design speed ( u ) using the formula below

S = 1.47 ut  + \frac{u^2}{30(\frac{a}{3.2} )-G1}  ----  ( 2 )

t = reaction time,  a = vehicle acceleration, G1 = grade percentage

assuming ; t = 2.5 sec , a = 11.2 ft/sec^2, G1 = 0

back to equation 2

6.99 = 1.47 * u * 2.5 + \frac{u^2}{30[(11.2/32.2)-0 ]}

3.675 u  + 0.0958 u^2 - 6.99 = 0

u ( 3.675 + 0.0958 u ) = 6.99

5 0
3 years ago
What Happens If A Sonic Boom Is Created?
Volgvan

Answer:

Explanation:

A sonic boom is a loud sound kind of like an explosion. It's caused by shock waves created by any object that travels through the air faster than the speed of sound. Sonic booms create huge amounts of sound energy. When an object moves through the air, it makes pressure waves in front of and behind it.

8 0
3 years ago
Because assembly language is so close in nature to machine language, it is referred to as a ____________.
My name is Ann [436]

Answer:

symbolic machine code.

Explanation:

The instructions in the language are closely linked to the machine's architecture.

5 0
4 years ago
A eutectic alloy is which of the following (two correct answers): (a) the composition in an alloy system at which the two elemen
NeTakaya

Answer:

Option (c) and option (d)

Explanation:

Eutectic system is one in which a solid and homogeneous mixture of two or more substances resulting in the formation of super lattice is formed which can melt or solidify at a temperature lower than the melting point of any individual metal.

Eutectic alloys are those which have its components mixed in a specific ratio.

It is the composition in an alloy system for which both the  liquidus and solidus temperatures are equal.

Eutectic alloys have the composition in which the melting point of the metal is lower than the other alloy composition.

3 0
3 years ago
The particle travels along the path defined by the parabola y=0.5x2, where x and y are in ft. If the component of velocity along
JulsSmile [24]

Answer:

D=41.48 ft

a=54.43\ ft/s^2

Explanation:

Given that

y=0.5 x²                      

Vx= 2 t

We know that

V_x=\dfrac{dx}{dt}

At t= 0 ,x=0  

x=\int V_x.dt

At t= 3 s

x=\int_{0}^{3} 2t.dt

x=[t^2\left\right ]_0^3

x= 9 ft

When x= 9 ft then

y= 0.5 x 9²  ft

y= 40.5 ft

So distance from origin is

x= 9 ft ,y= 40.5 ft

D=\sqrt{9^2+40.5^2} \ ft

D=41.48 ft

a_x=\dfrac{dV_x}{dt}

Vx= 2 t

a_x= 2\ ft/s^2

At t= 3 s , x= 9 ft

y=0.5 x²    

a_y=\dfrac{d^2y}{dt^2}

y=0.5 x²    

\dfrac{dy}{dt}=x\dfrac{dx}{dt}

\dfrac{d^2y}{dt^2}=\left(\dfrac{dx}{dt}\right)^2+x\dfrac{d^2x}{dt^2}

Given that

\dfrac{dx}{dt}=2t

\dfrac{dx}{dt}=2\times 3

\dfrac{dx}{dt}=6\ ft/s

a_y=\dfrac{d^2y}{dt^2}=6^2+9\times 2\ ft/s^2

a_y=54\ ft/s^2

a=\sqrt{a_x^2+a_y^2}\ ft/s^2

a=\sqrt{2^2+54^2}\ ft/s^2

a=54.43\ ft/s^2

7 0
4 years ago
Other questions:
  • An alloy has a yield strength of 818 MPa and an elastic modulus of 104 GPa. Calculate the modulus of resilience for this alloy [
    13·1 answer
  • EMB agar is a medium used in the identification and isolation of pathogenic bacteria. It contains digested meat proteins as a so
    10·1 answer
  • Hot water at an average temperature of 88°C and an average velocity of 0.4 m/s is flowing through a 5-m section of a thin-walled
    5·1 answer
  • ¿Cuándo se formarán cristales en una mezcla que se está evaporando?
    9·1 answer
  • Water at 15°C is to be discharged from a reservoir at a rate of 18 L/s using two horizontal cast iron pipes connected in series
    6·1 answer
  • You will be observing laminar-turbulent transition for room temperature (about 20°C) water flowing in a 0.602"" ID pipe (Schedul
    8·1 answer
  • Convert.46 to a percentage
    7·1 answer
  • What is one major life lesson you learned from the movie; ¨Spare Parts¨
    6·2 answers
  • YO CUTIE! HELP MEEEEEE! Hazardous waste is a category that includes all of the following EXCEPT
    13·2 answers
  • What is digital communication?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!