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
SCORPION-xisa [38]
3 years ago
14

Write a program that allows you to enter grocery item names into an array of strings and the cost of each item in an array of do

ubles. At the beginning of the program prompt the user to enter the total number of items they will be entering. Max value of 100. After entering the item names and cost, the application should display the names and cost and total cost of all items.
Engineering
1 answer:
harina [27]3 years ago
5 0

Answer:

#include <iostream>

#include <iomanip>

using namespace std;

int main(){

//declare arrays

string ItemName[100];

double ItemCost[100]={0.0};

//declare variable

string name="";

double Total=0.0;

int NumItems=0;

cout<<"Enter number of grocery item you will be entering";

cin>>NumItems

cout<<"\n";

if (NumItems>100)

{

  cout<<"Enter grocery items less than 100"

  cin>>NumItems

  cout<<"\n";

}

for (int i=1;i>=NumItems;i++)

{

  cout<<"Please enter the item name in one word only, Example:                                icecream\n";

  cin>>ItemName[i]

  cout<<"Please enter the cost as a decimal number, Example: 2.05\n\n";

  cin>>ItemCost[i];

}

cout<<"Items"<<"   "<<""$""<<"Cost"<<endl

for (int i=1;i>=NumItems;i++)

{

    cout<<ItemName[i]<<"   "<<"$"<<ItemCost[i]<<endl

}

for (int i=1;i>=NumItems;i++)

{

  Total=Total+ItemCost[i];

}

cout<<"Total:$"<<Total<<endl;

system("PAUSE");

return 0;

}

You might be interested in
Five Kilograms of continuous boron fibers are introduced in a unidirectional orientation into of an 8kg aluminum matrix. Calcula
Lunna [17]

Answer:

Explanation:

Given that,

Mass of boron fiber in unidirectional orientation

Mb = 5kg = 5000g

Mass of aluminum fiber in unidirectional orientation

Ma = 8kg = 8000g

A. Density of the composite

Applying rule of mixing

ρc = 1•ρ1 + 2•ρ2

Where

ρc = density of composite

1 = Volume fraction of Boron

ρ1 = density composite of Boron

2 = Volume fraction of Aluminum

ρ2 = density composite of Aluminum

ρ1 = 2.36 g/cm³ constant

ρ2 = 2.7 g/cm³ constant

To Calculate fractional volume of Boron

1 = Vb / ( Vb + Va)

Vb = Volume of boron

Va = Volume of aluminium

Also

To Calculate fraction volume of aluminum

2= Va / ( Vb + Va)

So, we need to get Va and Vb

From density formula

density = mass / Volume

ρ1 = Mb / Vb

Vb = Mb / ρ1

Vb = 5000 / 2.36

Vb = 2118.64 cm³

Also ρ2 = Ma / Va

Va = Ma / ρ2

Va = 8000 / 2.7

Va = 2962.96 cm³

So,

1 = Vb / ( Vb + Va)

1 = 2118.64 / ( 2118.64 + 2962.96)

1 = 0.417

Also,

2= Va / ( Vb + Va)

2 = 2962.96 / ( 2118.64 + 2962.96)

2 = 0.583

Then, we have all the data needed

ρc = 1•ρ1 + 2•ρ2

ρc = 0.417 × 2.36 + 0.583 × 2.7

ρc = 2.56 g/cm³

The density of the composite is 2.56g/cm³

B. Modulus of elasticity parallel to the fibers

Modulus of elasticity is defined at the ratio of shear stress to shear strain

The relation for modulus of elasticity is given as

Ec = = 1•Eb+ 2•Ea

Ea = Elasticity of aluminium

Eb = Elasticity of Boron

Ec = Modulus of elasticity parallel to the fiber

Where modulus of elastic of aluminum is

Ea = 69 × 10³ MPa

Modulus of elastic of boron is

Eb = 450 × 10³ Mpa

Then,

Ec = = 1•Eb+ 2•Ea

Ec = 0.417 × 450 × 10³ + 0.583 × 69 × 10³

Ec = 227.877 × 10³ MPa

Ec ≈ 228 × 10³ MPa

The Modulus of elasticity parallel to the fiber is 227.877 × 10³MPa

OR Ec = 227.877 GPa

Ec ≈ 228GPa

C. modulus of elasticity perpendicular to the fibers?

The relation of modulus of elasticity perpendicular to the fibers is

1 / Ec = 1 / Eb+ 2 / Ea

1 / Ec = 0.417 / 450 × 10³ + 0.583 / 69 × 10³

1 / Ec = 9.267 × 10^-7 + 8.449 ×10^-6

1 / Ec = 9.376 × 10^-6

Taking reciprocal

Ec = 106.66 × 10^3 Mpa

Ec ≈ 107 × 10^3 MPa

Note that the unit of Modulus has been in MPa,

7 0
3 years ago
A glass plate is subjected to a tensile stress of 40 MPa. If the specific surface energy is 0.3 J/m2 and the modulus of elastici
Alika [10]

Answer:

The maximum length of a surface flaw is 8.24 μm

8.24 μm

Explanation:

Given that:

The modulus of elasticity E = 69 GPa

The specific surface energy \delta_s = 0.3 J/m²

The length of the surface flaw "a" = ??

From the theory of the brittle fracture;

\sigma _c = \bigg (  \dfrac{2E \delta_s}{\pi a}  \bigg )^{1/2}

Making a the subject of the formula; we have:

a = \bigg (  \dfrac{2 \times E \times \delta_s}{\pi \sigma _c ^2}  \bigg )

a= \bigg (  \dfrac{2 \times 69*10^9 \times 0.3}{\pi (40*10^6)^2}  \bigg )

a = 8.24 × 10⁻⁶ m

a = 8.24 μm

Thus; the maximum length of a surface flaw is 8.24 μm

3 0
3 years ago
T he area of a circle is pr 2. Define r as 5, then find the area of a circle,using MATLAB®.(b) The surface area of a sphere is 4
aksik [14]

Answer:

Area of Circle = 78.5398

Surface Area of Sphere =  1.2566 x 10^3 = 1256.6 ft

Volume of Sphere =  33.5103 ft

Explanation:

Please find below the written MatLab script used to solve the problem. I had to define r in each case to solve for the Area of the circle, the surface area and the volume of the Sphere.

r=5; % define r as 5

a=pi*r^2;% calculate the area of the circle

AreaOfCircle=a

r=10; % define r and 10 ft

sa=4*pi*r^2; %Calculate the surface area of the sphere

SphereSurfaceArea=sa

r=2;% define r as 2 ft

vs=(4/3)*pi*r^3;% Calculate the volume of the sphere

VolumeShere=vs

3 0
3 years ago
Read 2 more answers
Determine the adiabatic flame temperature of carbon monoxide (CO) burning in air at an equivalence ratio of unity. The reactants
zheka24 [161]

Answer:

Explanation:

The detailed analysis and step by step calculation is as shown in the attachment.

3 0
4 years ago
Which process must first take place in order for the proteins in foods to be used by body cells?
barxatty [35]

Answer:

Digestion

1 is correct since you need to eat something before anything else.

2 is incorrect since if this was first, what are you storing?

3 is incorrect since that is the second thing you need to do.

4 is incorrect since that is the last thing to do.

5 0
3 years ago
Other questions:
  • Iron has a BCC crystal structure, an atomic radius of 0.124 nm, and an atomic weight of 55.85 g/mol. Compute and compare its the
    8·1 answer
  • / Air enters a 20-cm-diameter 12-m-long underwater duct at 50°C and 1 atm at a
    7·1 answer
  • What are the two types of furnaces used in steel production?
    5·1 answer
  • A hydraulic cylinder has a 125-mm diameter piston with hydraulic fluid inside the cylinder and an ambient pressure of 1 bar. Ass
    8·1 answer
  • I got a rubber band car assigned as a project today. The goal is for the car to go farther/faster than the car my teacher is mak
    6·1 answer
  • Create a document that includes a constructor function named Company in the document head area. Include four properties in the C
    7·1 answer
  • Consider a cubic block whose sides are 6 cm long and a cylindrical block whose height and diameter are also 6 cm. both blocks ar
    8·1 answer
  • Guys do u know who is
    5·2 answers
  • List six possible valve defects that should be included in the inspection of a used valve?
    7·1 answer
  • The volume of microbial culture is observed to increase according to the formula
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!