Write a program to perform the following: Create an array of 7 double random values (the price of items) between 1.0 and 100.0. Create an array of 7 integer random values(units of items sold) between 0 and 100. Create an array called “total sale” which contains the total sale for each item. Calculate the total sale for this store and display it If the number of items sold is more than 50, print that item#? needs to be reordered.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section10.3: Pointer Arithmetic
Problem 4E
icon
Related questions
Question

C Programming 

Write a program to perform the following:

  • Create an array of 7 double random values (the price of items) between 1.0 and 100.0.
  • Create an array of 7 integer random values(units of items sold) between 0 and 100.
  • Create an array called “total sale” which contains the total sale for each item.
  • Calculate the total sale for this store and display it
  • If the number of items sold is more than 50, print that item#? needs to be reordered.

Display Example; -------------------------------------------

item # Price (random) Units Sold (random) Total Sale (price*units sold)
1 25.23 2 50.46
2 3.45 100 345.00
3 40.56 34 1,379.04
: : : :
7 12.35 48 592.80

The total sale of this store is ???.

Item #3 needs to be reordered.

------------------------------------------------------------

1. Must create functions to generate random numbers for each array

2. Must use a function to calculate the sale of each item

3. Do not use Exit statement.

4. Do not use global variables.

5. Single return from a function.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,