Question

In: Computer Science

Using Dev-C++ write a program that allows a small business owner to input, in parallel arrays,...

Using Dev-C++ write a program that allows a small business owner to input, in parallel arrays, the type of item, its cost, and the number in stock. The program should output this information in the form of a table. The output will look something like below. Also, assume for a finite number of item name of 3
Item Name Cost Number in Stock
Widget 25.00 4

... ... ...

Wombet 47.50 9

Prelude to Programming (6th edition)

Solutions

Expert Solution

Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change.

If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions.

Thank You!
===========================================================================

#include<iostream>
#include<iomanip>
#include<string>


using namespace std;

int main(){
  
   string names[3];
   double prices[3];
   int quantities[3];
  
   for(int i=0; i<3; i++){
       cout<<"Enter Details for Item #" << i+1<<endl;
       cout<<"Enter item name: "; getline(cin,names[i],'\n');
       cout<<"Enter item price: "; cin >> prices[i];
       cout<<"Enter quantity: "; cin >> quantities[i];
       cin.ignore(256,'\n');
       cout<<endl;
      
   }
  
   cout<<left<<setw(15)<<"Item Name";
   cout<<right<<setw(10)<<"Cost";
   cout<<right<<setw(20)<<"Number in Stock";
   cout<<endl;
  
       for(int i=0; i<3; i++){
          
           cout<<left<<setw(15)<<names[i];
           cout<<right<<setprecision(2)<<fixed<<showpoint<<setw(10)<<prices[i];
           cout<<right<<setw(10)<<quantities[i];
           cout<<endl;
          
       }
  


   return 0;
}
================================================================


Related Solutions

Write a C++ program using dynamic arrays that allows the user to enter the last names...
Write a C++ program using dynamic arrays that allows the user to enter the last names of the candidates in a local election and the number of votes received by each candidate. The program must ask the user for the number of candidates and then create the appropriate arrays to hold the data. The program should then output each candidate’s name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should...
Write a C++ program to do the following USING ARRAYS 1) input 15 integers (input validation...
Write a C++ program to do the following USING ARRAYS 1) input 15 integers (input validation , all numbers must be between 0 and 100) 2) find the largest number 3) Find the Smallest Number 4) Find the Sum of all numbers in the Array Display: as per the user's section (menu using switch or if else ) Largest Number Smallest Number Sum of all numbers the original Array DO NOT USE METHODS OR FUNCTIONS Submit: Source code (C++) output...
Write a Java program to do the following USING ARRAYS 1) input 15 integers (input validation,...
Write a Java program to do the following USING ARRAYS 1) input 15 integers (input validation, all numbers must be between 0 and 100) 2) find the largest number. 3) Find the Smallest Number 4) Find the Sum of all numbers in the Array Display: Largest Number Smallest Number Sum of all numbers the original Array DO NOT USE METHODS OR FUNCTIONS
Objective: Write this program in the C programming language Loops with input, strings, arrays, and output....
Objective: Write this program in the C programming language Loops with input, strings, arrays, and output. Assignment: It’s an organization that accepts used books and then sells them a couple of times a year at book sale events. Some way was needed to keep track of the inventory. You’ll want two parallel arrays: one to keep track of book titles, and one to keep track of the prices. Assume there will be no more than 10 books. Assume no more...
Write a program of Binary Search in C++ by using function and arrays with the explanation.
Write a program of Binary Search in C++ by using function and arrays with the explanation.
Write a program in c++ using only while and for loops . Use of arrays and...
Write a program in c++ using only while and for loops . Use of arrays and functions is not allowed. Given the first value, generate the next ten terms of the sequence like 1, 2, 4, 8, 16, 22, 26, 38, 62, 74, 102, 104, … Explaination with code is required.
Write a program in C# for a Cricket match using Jagged Arrays. The name of the...
Write a program in C# for a Cricket match using Jagged Arrays. The name of the project will be on your name. It has the following modules: Create two functions in class Cricket_Match for random numbers generation. The first function generates 1-6 numbers which is known as balls played by each player. The second function generates a 0-6 number which is known as the score produced against each ball by an individual player. In the main show the individual player...
Please code C# 10. Write a program that allows a user to input names and corresponding...
Please code C# 10. Write a program that allows a user to input names and corresponding heights (assumed to be in inches). The user can enter an indefinite number of names and heights. After each entry, prompt the user whether they want to continue. If the user enters true, ask for the next name and height. If the user enters false, display the name of the tallest individual and their height. Sample run: “Name?” James “Height?” 50 “Continue?” True “Name?”...
Using C++ (microsoft visual studios 2013) create a program that uses three parallel numberic arrays of...
Using C++ (microsoft visual studios 2013) create a program that uses three parallel numberic arrays of size 6. The program searches one of the arrays and then displays the corresponding values from the other two arrays. The program should prompt the user to enter ProductID. Valid ProductID's should be the numbers 24, 37, 42, 51, 66 and 79. The program should search the array for the product ID in the ID's array and display the corresponding price and quantity from...
For this assignment, you need to write a parallel program in C++ using OpenMP for vector...
For this assignment, you need to write a parallel program in C++ using OpenMP for vector addition. Assume A, B, C are three vectors of equal length. The program will add the corresponding elements of vectors A and B and will store the sum in the corresponding elements in vector C (in other words C[i] = A[i] + B[i]). Every thread should execute an approximately equal number of loop iterations. The only OpenMP directive you are allowed to use is:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT