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 flywheel made of Grade 30 cast iron (UTS = 217 MPa, UCS = 763 MPa, E = 100 GPa, density = 7100 Kg/m, Poisson's ratio = 0.26) h
hram777 [196]

Answer:

N = 38546.82 rpm

Explanation:

D_{1} = 150 mm

A_{1}= \frac{\pi }{4}\times 150^{2}

              = 17671.45 mm^{2}

D_{2} = 250 mm

A_{2}= \frac{\pi }{4}\times 250^{2}

              = 49087.78 mm^{2}

The centrifugal force acting on the flywheel is fiven by

F = M ( R_{2} - R_{1} ) x w^{2} ------------(1)

Here F = ( -UTS x A_{1} + UCS x A_{2} )

Since density, \rho = \frac{M}{V}

                        \rho = \frac{M}{A\times t}

                        M = \rho \times A\times tM = 7100 \times \frac{\pi }{4}\left ( D_{2}^{2}-D_{1}^{2} \right )\times t

                        M = 7100 \times \frac{\pi }{4}\left ( 250^{2}-150^{2} \right )\times 37

                        M = 8252963901

∴ R_{2} - R_{1} = 50 mm

∴ F = 763\times \frac{\pi }{4}\times 250^{2}-217\times \frac{\pi }{4}\times 150^{2}

  F = 33618968.38 N --------(2)

Now comparing (1) and (2)

33618968.38 = 8252963901\times 50\times \omega ^{2}

∴ ω = 4036.61

We know

\omega = \frac{2\pi N}{60}

4036.61 = \frac{2\pi N}{60}

∴ N = 38546.82 rpm

7 0
4 years ago
A generator is to be driven by a small Pelton wheel with a head of 91.5m at inlet to the nozzle and discharge of 0.04m^3/s. The
maria [59]

Answer:

ratio = 412

speed of wheel = 13.63

Explanation:

given data

head h = 91.5 m

discharge Q = 0.04 m³/s

wheel rotates N = 720 rpm

velocity coefficient Cv = 0.98

efficiency of the wheel η = 80 %

ratio of bucket speed to jet speed \frac{u}{v} = 0.46

to find out

wheel to jet diameter ratio and power specific speed of the wheel

solution

we know that discharge = area × velocity .............1

here velocity = Cv√(2gh)

velocity = 0.98√(2×9.81×91.5) = 41.52 m/s

and area = \frac{\pi }{4} d^2

so from equation 1

0.04 = \frac{\pi }{4} d^2 ×  41.52

d = 0.00123 m = 1.23 mm

we know bucket speed to jet speed = 0.46

so bucket speed u = 0.46 v

bucket speed u = 0.46 × 41.52 = 19.1 m/s

and bucket speed = \frac{\pi D N}{60}      

so 19.1 = \frac{\pi D 720}{60}  

so D = 0.506 m = 506.62 mm

so ratio is \frac{D}{d} = \frac{506.62}{1.23}

ratio = 412

and

we know efficiency = \frac{outputpower}{inputpower}

0.80 × ρQgh = output power

power output = 0.80 ×1000×0.04×9.81×91.5

power output P = 28.72 kW

so

speed of wheel is

speed of wheel = \frac{N\sqrt{P} }{h^{5/4}}

speed of wheel = \frac{720\sqrt{28.72} }{91.5^{5/4}}

speed of wheel = 13.63

7 0
4 years ago
Exercise 6.4.8: Sum Two Number
kaheart [24]

Below is the program with function that takes two arguments and returns their sum.

Coding part:

def add_num(a1,b1): /*function for addition*/

  sum=a1+b1

  return sum /*return value*/

num1z1=33  /*variable declaration*/

num2z2=78

print("The sum is",add_num(num1z1,num2z2)) /*call the function*/

What is Function?

A function is a piece of code that performs a specific task. It is callable and reusable multiple times. You can pass data to a function, and it can return data to you. Many programming languages include built-in functions that can be found in their libraries, but you can also write your own.

To learn more about Function, visit: brainly.com/question/17216645

#SPJ1

3 0
1 year ago
A generator that produces 40 kilowatts uses twice as much fuel in an hour as a generator that produces 20 kilowatts. Explain why
mars1129 [50]

Answer:

In terms of energy conversion/transformation the generator that produces 40 kilowatts of power will consume twice as much fuel than a generator that produces 20 watts because the more electrical power produced by an electrical generator, the more fuel is consumed. The amount of electrical energy produced is directly proportional to the fuel consumed.  

Explanation:

Energy transformation is the conversion of energy from one form to another. Their are various forms of energy namely kinetic energy, electric energy, mechanical energy , chemical energy , solar energy, heat energy , nuclear energy. These energy can be transformed from one form to another . Example our body convert chemical energy through food we eat to mechanical energy.  

The generator transforms  mechanical energy into electrical energy . The kilowatts tells you the amount of power the generator produces .The energy is measured in kilowatts per hour which is the power used over a period of time.

In terms of energy conversion/transformation the generator that produces 40 kilowatts of power will consume twice as much fuel than a generator that produces 20 watts because the more electrical power produced by an electrical generator, the more fuel is consumed. The amount of electrical energy produced is directly proportional to the fuel consumed.   So far the generator conversion efficiency are equal  for both generators the generator with the higher power generation will consume more fuel per hour.  

5 0
3 years ago
Imagine you are designing a new backpack. Which of the following statement(s) about
Hoochie [10]
The answer is D.) both A and C
3 0
3 years ago
Read 2 more answers
Other questions:
  • 2.) For a 20‐mm‐diameter tube with either water or unused engine oil flowing through it, find: a.)The mean velocity, hydrodynami
    9·1 answer
  • Steam enters an adiabatic turbine at 8 MPa and 500°C at a rate of 18 kg/s, and exits at 0.2 MPa and 300°C. Determine the rate of
    7·1 answer
  • The basic barometer can be used to measure the height of a building. If the barometric readings at the top and the bottom of a b
    15·1 answer
  • A pipe of inner radius R1, outer radius R2 and constant thermal conductivity K is maintained at an inner temperature T1 and oute
    14·1 answer
  • "Compute the flow time, tardiness, and lateness for each job, and the average flow time, average tardiness, and average lateness
    10·1 answer
  • Recovery Assignment 3: Engineering ethics 1 1/2 page typed
    6·1 answer
  • Please help me with this, picture.
    15·1 answer
  • You are using a Jupyter Notebook to explore data in a DataFrame named productDF. You want to write some inline SQL by using the
    8·1 answer
  • What is the primary reason that heating, ventilating, and air conditioning (HVAC) is critical to a data center
    8·1 answer
  • Clean dry and wet mops monthly.<br> O True<br> O False
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!