Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

All code must be in C++ using G++ compiler Write a program that computes the tot

ID: 3809605 • Letter: A

Question

All code must be in C++ using G++ compiler

Write a program that computes the total revenue earned during an entire month at an electronics shop The shop sells 10 different items, and we have information regarding the the total number of items sold and the year of manufacture for each type of the item create three parallel arrays. An array named "cost" (type double) will hold the cost of each type of the item, an array named "yearofmanufacture" (type int) will hold the manufacturing year of each type of the item, and lastly an array named "soldcount" (type int) will hold the number of items sold for each type of the item. Based on the year of manufacture, each type of the item has a discount as per the following table.

Explanation / Answer

In this question ,it is about to find revenue,

In program we first get 10 inputs of 10 different cost,10 different year and 10 different number of items using array.

After that we create a function discount for find discount,Then we call this function and pass 3 parameters of cost,year and numberof items.

In discount function we check the year based on table you given.

Then we find total amount of each item using discount amount,using (cost*numberofitem - discount) and then print total addition of amount of each item.

This is the c++ file:

#include<iostream>

using namespace std;
float discount(float cost,float year, float soldcount)
{
   float ans;
   if(year >= 1991 && year <= 2000)
   {
       ans=cost * soldcount * 0.40 ;
   }
   else if(year >= 2001 && year <= 2010)
   {
       ans= cost * soldcount * 0.20 ;
   }
   else if(year >= 2011 && year <= 2017)
   {
       ans=cost * soldcount * 0.10 ;
   }
   else
   {
       cout<<"Enter valid year";
   }
  
   return ans;
  
}

int main()
{
  
   float cost[10];
   float yearofmanufacture[10];
   float soldcount[10];
   float total[10];
   float final[10];
   int i;
   float totalr=0;
  
   cout<<"Enter Cost of 10 Items.";
   for(i=0 ;i<10;i++)
   {
       cin>>cost[i];
   }
  
   cout<<"Enter year of manufacture";
   for(i=0 ;i<10;i++)
   {
       cin>>yearofmanufacture[i];
   }
  
   cout<<"Enter number of items sold:";
   for(i=0 ;i<10;i++)
   {
       cin>>soldcount[i];
   }
  
   for(i=0 ;i<10;i++)
   {
       total[i]=discount(cost[i],yearofmanufacture[i],soldcount[i]);
      
       final[i] = (cost[i] * soldcount[i]) - total[i];
       totalr += final[i];
   }
  
   cout<<"Total revenue earned is: $"<<totalr;
  
   return 0;
  

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote