C++ exercises
During the tax season, every Friday, the J&J accounting firm provides assistance to people who prepare their own tax returns. Their charges are as follows:
If a person has low income (<= 25,000) and the consulting
time is less than or equal to 30 minutes, there are no charges;
otherwise, the service charges are 40% of the regular hourly rate
for the time over 30 minutes.
For others, if the consulting time is less than or equal to 20
minutes, there are no service charges; otherwise, service charges
are 70% of the regular hourly rate for the time over 20 minutes.
(For example, suppose that a person has low income and spent 1 hour
and 15 minutes, and the hourly rate is $70.00. Then the billing
amount is 70.00 X.40 X (45/60) = $21.00.)
Instructions
Write a program that prompts the user to enter yearly income, the
hourly rate, the total consulting time. The program should output
the billing amount. Your program must contain a function that takes
as input the hourly rate, the total consulting time, and a value
indicating whether the person has low income. The function should
return the billing amount. Your program may prompt the user to
enter the consulting time in minutes.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The cost to become a member of a fitness center is as follows:
the senior citizens discount is 30%;
if the membership is bought and paid for 12 or more months, the
discount is 15%;
if more than five personal training sessions are bought and paid
for, the discount on each session is 20%.
Write a menu-driven program that determines the cost of a new
membership. Your program must contain a function that displays the
general information about the fitness center and its charges, a
function to get all the necessary information to determine the
membership cost, and a function to determine the membership cost.
Use appropriate parameters to pass information in and out of a
function. (Do not use any global variables.)
An example of the program is shown below:
Welcome to Stay Healthy and Fit center.
This program determines the cost of a new membership.
If you are a senior citizen, then the discount is 30% of the
regular membership price.
If you buy membership for twelve months and pay today, the discount
is 15%.
If you buy and pay for 6 or more personal training session today,
the discount on each session is 20%.
Enter the cost of a regular membership per month: 50
Enter the cost of one personal training session: 10
Are you a senior citizen (Y,y/N,n): n
Enter the number of personal training sessions bought: 3
Enter the number of month you are paying for: 1
The membership cost = $80.00
Since your program handles currency, make sure to use a data type
that can store decimals with a decimal precision of 2.
1.
#include <iostream>
using namespace std;
void bill(float r, float t, bool i) {
if(i==1) {
if(t<=30)
cout<<"\nNO charges";
else
cout<<"\nCharges = $"<<0.4*r*(t/60);
}
else {
if(t<=20)
cout<<"\nNO charges";
else {
//if(t>60)
//t=t/60;
cout<<"\nCharges = $"<<0.7*r*(t/60);
}
}
}
int main()
{
float y_income,c_time;
bool income=0;
float rate;
cout<<"Enter Your yearly income:";
cin>>y_income;
cout<<"Enter the hourly rate:";
cin>>rate;
cout<<"Enter the total consulting time (in minutes)";
cin>>c_time;
if(y_income<=25000) {
income=1;
}
bill(rate,c_time,income);
return 0;
}
Output
C++ exercises During the tax season, every Friday, the J&J accounting firm provides assistance to people...
During the tax season, every Friday, J&J accounting firm provides assistance to people who prepare their own tax returns. Their charges are as follows: If a person has low income (<=25,000) and the consulting time is less than or equal to 30 minutes, there are no charges; otherwise the srvice charges 40% of the regular hourly rate for the time over 30 minutes. For others, if the consulting time is less than or equal to 20 minutes, there are no...
- The senior citizens discount is 30% e If the membership is bought and paid for 12 or more months, the discount is 15% . If more than five personal training sessions are bought and paid for, the discount on each session is 20%. Write a menu-driven program that determines the cost of a new membership. Your program must contain a function that displays the general information about the fitness center and its charges, a function to get all of...
Please !create a java program for the follwing question.
19. The cost to become a member of a fitness center is as follows: (a) the Senior citizens discount is 30%; (b) if the membership is bought and paid for 12 or more months in advance, the discount is 15%; or (c) if more than 5 personal training sessions are purchased, the discount on each session is 20%. Write a menu driven program that determines the cost of a new membership...
Write a java program. The cost to join a gym is: 1) Senior citizens: get a 30% discount. 2.) If twelve or more months in advance are bought and paid for, a 15% discount is applied to the membership. The user enters the number of months. 3) Personal Training sessions: 20% discount on each session if more than 12 are bought. This will be a menu-driven, GUI program that determines the cost of a new membership.Using JTextField for input and...
Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...