This program will read a bunch of numbers from an external file (numbers.txt) and calculate their total and average. In addition, the total will be multiplied by an integer that is supplied by the user.
** IMPORTANT: The numbers are included in your starter code as a separate file (numbers.txt). Don't touch that file! All of your code should be placed in code.cpp, as usual. **
Input:
After all numbers are read, what number would you like to multiply the total by? [user types: 2]
Output:
Total = 1717
Average = 50.5
Total * 2 = 3434
Create an Inventory class that a warehouse might use to represent their stock of products and raw materials. Include a data member of type string to provide a description of the product, and data member of type int to represent the balance stock. Provide a constructor that receives an initial product and uses it to initialize the data members. The constructor should validate the initial product to ensure it has a stock greater than 20, which is the company’s minimum stock level. If not, it should display an error message. Provide three member functions. Member function Purchase should add a product to the current stock. Member function Sale should reduce stock. Ensure after each sale that the stock level does not drop below 20. Member function getStock should return the current stock. Create a program that creates two Inventory objects and tests the member functions of the class.
In the main function, define an array that can contain four int values. Also define an int named sum.
Write a function named getData which asks the user for the data and puts it in the array.
Write a function named computeTotal which adds the data in the array and returns the sum.
Write a function named printAll which takes the array and the sum as arguments.
In the main function, call the getData function.
Then in the main function, call the computeTotal function.
Then in the main function, call the printAll function.
Print the results in the formats shown in the following format:
4 + 6 + 9 + 12 = 31
Test the program twice with the values:
4, 6, 9, and 12.
then with the values:
1, 7, 9, and 15.
You do not need to use any functions beyond the main function in this problem.
Initialize an array of int with the values: 4, 6, 9, and 12.
Write a for loop to add the values in the array and find their sum.
Use a loop to print the values in the array.
Print the values in the array and the sum in the following format:
4 + 6 + 9 + 12 = 31
In the main function, define five variables of type int, named: first, second, third, fourth, and total. Also in the main function, define three variables of type double named: decimalOne, decimalTwo and decimalTotal
Write one function named getData which asks the user for the data and puts it in first, second, third, fourth, decimalOne, and decimalTwo. (You may copy your getData from problem I1 and make additions to manage fourth, decimalOne, and decimalTwo.) Write a function named computeTotal which can take two, or three int arguments and returns an int. Write another function, also named computeTotal which takes four int arguments and returns an int. Write another function, also named computeTotal which takes two double arguments and returns a double. Write a function named printAll which takes three arguments of type int. Write a function named printAll which takes four arguments of type int.
// I will add the rest of the question in the comment
In the main function, define five variables of type int, named: first, second, third, fourth, and total. Also in the main function, define three variables of type double named: decimalOne, decimalTwo and decimalTotal
Write one function named getData which asks the user for the data and puts it in first, second, third, fourth, decimalOne, and decimalTwo. (You may copy your getData from problem I1 and make additions to manage fourth, decimalOne, and decimalTwo.) Write a function named computeTotal which can take two, or three int arguments and returns an int. Write another function, also named computeTotal which takes four int arguments and returns an int. Write another function, also named computeTotal which takes two double arguments and returns a double. Write a function named printAll which takes three arguments of type int. Write a function named printAll which takes four arguments of type int.
// I will ask the rest of the question in the comment
In the main function, define four variables of type int, named: first, second, third, and total.
Write a function named getData that asks the user to input three integers and stores them in the variables first, second, and third which are in the main function.
Write a function named computeTotal that computes and returns the total of three integers.
Write a function named printAll that prints all the values in the format shown in the following sample:
1 + 2 + 3 = 6
Call the other three functions from the main function.
Test it once, with the values 4, 5, and 6.
Design a class art that contain the details of artist, country and class info contain the details of year and art-type (fancy, historic or modern). Use a function for displaying the details by reading data from class art and info. The function used for displaying is not a member of any class
Create a C++ program that allows the user to enter a maximum number from 20-40. From the number entered by the user, print the even numbers using for loop and do while loop for the odd numbers.
Create a C++ program using for loops and do while loop that give this output:
Enter the maximum number are: 21
Even numbers are :2 4 6 8 10 12 14 16 18 20
Odd numbers are :1 3 5 7 9 11 13 15 17 19 21