Question

In: Computer Science

c++120 Holideals at the Movies! We have special movie tickets on holidays! Prices are discounted when...

c++120

Holideals at the Movies!

We have special movie tickets on holidays! Prices are discounted when you buy a pair of tickets.

Create a program for the HoliDeals event that computes the subtotal for a pair of tickets. The program should ask the the ages of the first and second guests to compute the price.

There are different pricing structures based on the guests' age.

Children tickets cost $10 (age below 13)

Young Adult tickets cost $13 (age below 21)

Adult tickets cost $15 (age below 65)

Senior tickets cost $10 (age 65 and over)

To simplify the problem, let's assume that parents/guardians will always accompany pairs of children who will watch a movie.

The pricing structure should be displayed to the user. Please see the sample output below to guide the design of your program.

Welcome to HoliDeals at the Movies!
Tickets tonight can only be bought in pairs.
Here are our movie ticket deals:

Children - $10.00
Young Adults - $13.00
Adults - $15.00
Seniors - $10.00

Please enter the age of the person for the first guest: 15
Please enter the age of the person for the second guest: 16

The Subtotal for the ticket cost is: $26.00.

Q2:

Salary Calculator

Create a program that computes the salary based on an employee's hourly wage and hours worked. Use the following formulas:

Less than or equal to 40 hours worked

hourly wage * hours worked

Over 40, but less than or equal to 65 hours worked

(hourly wage * 40) + (hours worked - 40) * (hourly wage * 1.5)

Over 65 hours worked

(hourly wage * 40) + (hourly wage * 1.5) * 25 + (hours worked - 65) * hourly wage * 2

Please see the sample output below to guide the design of your program.

Hourly wage: 12
Hours worked: 20
Total Salary Owed: $240.00

Solutions

Expert Solution

Q1)

Here is your code..

#include<iostream>
#include <iomanip>
using namespace std;
int main()
{
   float price,total_price=0;
   int persons=1,age;
   cout<<"Welcome to HoliDeals at the Movies!" <<endl;
   cout<<"Tickets tonight can only be bought in pairs." <<endl;
   cout<<"Here are our movie ticket deals:" <<endl;
   cout<<endl;
   cout<< "Children - $10.00" <<endl;
   cout<<"Young Adults - $13.00"<<endl;
   cout<<"Adults - $15.00"<<endl;
   cout<<"Seniors - $10.00"<<endl;
   cout<<endl;
   while (persons<=2) {
   if(persons!=1){
           cout << "Please enter the age of the person for the second guest: ";
       } else {
           cout << "Please enter the age of the person for the first guest: ";
       }
cin >> age;
{
if (age < 13)
price = 10.00;
else if (age>=13 && age < 21)
price = 13.00;
else if (age>=21 && age<65)
price = 15.00;
else
   price = 10.00;
}

total_price = price + total_price;

persons++;
}
cout << fixed;
cout << setprecision(2);
   cout << "The Subtotal for the ticket cost is: $ " << total_price;
   return 0;
}

Q2)

Here is your code...

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
   float Hwage,TotalSalary;
   int Hworked;
   cout<<"Hourly wage: ";
   cin>>Hwage;
   cout<<"Hours worked: ";
   cin>>Hworked;
   if(Hworked<=40)
   {
       TotalSalary = Hworked * Hwage;
   }
   else if (Hworked>40 && Hworked <=65)
   {
       TotalSalary = (Hwage * 40) + (Hworked - 40) * (Hwage * 1.5);
   }
   else
   {
       (Hwage * 40) + (Hwage * 1.5) * 25 + (Hworked - 65) * Hwage * 2;
   }
   cout << fixed;
cout << setprecision(2);
   cout<<"Total Salary Owed : $ "<<TotalSalary;
   return 0;
}


Related Solutions

Sometimes consumers don’t face the same prices. For example, a movie theater may offer cheaper tickets...
Sometimes consumers don’t face the same prices. For example, a movie theater may offer cheaper tickets to senior citizens, or local restaurants may provide student discounts. How would different prices charged to different people change our model of the consumer problem? Would people end up at points on the ICs with the same slope upon solving their consumer problems? If not, why wouldn’t they be able to improve themselves through mutually beneficial trades (keeping in mind the movie ticket and...
Theater tickets for a hit show have four prices depending on seating. The prices ae $50,...
Theater tickets for a hit show have four prices depending on seating. The prices ae $50, $100, $150 and $200. The probability a ticket sells for $50 is .4. The probability it sells for $100 is .15. The probability it sells for $150 is .2. Find the probability a ticket sells for $200. Find the expected cost (mean cost) of a ticket. Find the standard deviation for the cost of a ticket Find the variance for the cost of a...
When prices in the economy have not fully adjusted, we say that: A. Group of answer...
When prices in the economy have not fully adjusted, we say that: A. Group of answer choices B. it is a period of time less than one year. C. we are in the short run. D. we are in the long run. E. the market is not in equilibrium. F. it is a period of time less than five years.
hypothesis tests you have three movies with ratings from trusted peers: movie #1: median=5 units mean=4.35...
hypothesis tests you have three movies with ratings from trusted peers: movie #1: median=5 units mean=4.35 units standard deviation=0.76 units movie #2: median=2 units mean=2.2 units standard deviation=0.59 units movie #3: median=5units mean=4.5 units standard deviation=0.62 units Which statistical test would be the best to use to compare the three rating distributions and see what movie is rated the best, comparing each movie two at a time for a total of three times? (comparing movies 1 & 2, 1 &...
A.1) We know that the yen and the Swiss franc have a 120 yen/ sf 1...
A.1) We know that the yen and the Swiss franc have a 120 yen/ sf 1 exchange rate, meaning one swiss franc buys 100 yen in the forward ER market. If the swiss franc has an interest rate of -.06 and the yen rate is -.02, what is the spot exchange rate for IPT (interest parity theory) to be attained ? Show everything in yen terms and franc terms. 2) If there is no equilibrium initially, will there be equilibrium...
We have discussed several types of shoring. If we have a certain project, when should we...
We have discussed several types of shoring. If we have a certain project, when should we do the shoring using sheet piles, Contiguous Piles, Secant Piles, Soldier Beams and Lagging, or Diaphram Walls? Compare between these different types and list the criteria at which we choose the appropriate shoring system for any project.We have discussed several types of shoring. If we have a certain project, when should we do the shoring using sheet piles, Contiguous Piles, Secant Piles, Soldier Beams...
Many countries have tried to raise prices of their exports when they have a controlling position...
Many countries have tried to raise prices of their exports when they have a controlling position in the market ( such as China with rare earth materials) or with others by forming a cartel (such as OPEC). How do they do it and why does this method work in the short run but fail in the long run?
What is the significance of -c , -g, -Wall and -o switches when we compile C/C++...
What is the significance of -c , -g, -Wall and -o switches when we compile C/C++ code ?
Companies are​ price-takers when​ ________. A. they have little or no control over the prices of...
Companies are​ price-takers when​ ________. A. they have little or no control over the prices of their products or services B. their products are unique C. there is very little competition D. pricing approach emphasizes​ cost-plus pricing
Explain why market prices will always converge to their fundamental value even when we disregard the...
Explain why market prices will always converge to their fundamental value even when we disregard the efficient market hypothesis.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT