Question

Write a java program. The cost to join a gym is: 1) Senior citizens: get a...

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 JLabel to describe what you want the user to input and buttons (calculate and exit).
-Senior Discount - The user chooses 0 or 1, yes or no, for senior.
-The user enters the number of months for membership.
   -The user enters the number of personal training sessions.
     

Program needs the following methods:

a. A method that displays general info about the gym and the charges using a JTextField
   Membership cost: $400
   Cost per training session: $70 per person
   List the discounts in this space

b. A method the gets all the information to determine the membership cost.

c. A method to determine the membership cost.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
01 #include <iostream>
02 #include <iomanip>
03 using namespace std;
04
05
06   
07 void display()
08 {
09       
10     cout << "\n                            Fitness Menu                            " << endl;
11
12     cout << "********************************************************************" << endl;
13
14     cout << "The cost of a monthly membership is $20. << endl;
15     cout << "The cost of each personal training session is $15. <<endl;
16     cout << "Senior citizen discount is 30%" << endl;
17
18     cout << "If membership has paid for 12 or more months, 15% discount" << endl;
19
20     cout << "If more than 5 personal training sessions are paid for, 20% discount" << endl;
21
22     cout << "********************************************************************\n" << endl;
23
24     return;
25
26 }
27
28 double askprice()
29 {
30
31    int price = 20;
32    int discount;
33
34    char ask='Y';
35
36    cout << "Are you a senior citizen? Type Y or N " << endl;
37
38    cin >> ask;
39     if(ask == 'Y')
40    {
41               discount = price - (price * 0.30);
42 }
43
44    cout << "Have you paid for more than 12 months? Type Y or N" << endl;
45
46    cin >> ask;
47    if(ask == 'Y')
48    {
49               discount = price - (price * 0.15);
50    }
51
52    cout << "Have you received more than 5 personal training sessions? Type Y or N" << endl;
53
54    cin >> ask;
55    if(ask == 'Y')
56    {
57               discount = price - (price * 0.20);
58
59     }
60
61
62 void decideTheprice()
63
64 {
65      cout<<" Your total comes to "<< askprice() << endl;
66      askprice =
67      }
68      int main()
69      {
70          display();
71          decideTheprice();
72          system("PAUSE");
73          return 0;
74          }
Add a comment
Know the answer?
Add Answer to:
Write a java program. The cost to join a gym is: 1) Senior citizens: get a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • - The senior citizens discount is 30% e If the membership is bought and paid for...

    - 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...

    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...

  • C++ Homework, The cost to become a member of a fitness center is as follows: the...

    C++ Homework, 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...

  • C++ exercises During the tax season, every Friday, the J&J accounting firm provides assistance to people...

    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...

  • JAVA Hello I am trying to add a menu to my Java code if someone can...

    JAVA Hello I am trying to add a menu to my Java code if someone can help me I would really appreacite it thank you. I found a java menu code but I dont know how to incorporate it to my code this is the java menu code that i found. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JRadioButtonMenuItem; public class MenuExp extends JFrame { public MenuExp() { setTitle("Menu Example");...

  • Write a Java program to convert octal (integer) numbers into their decimal number equivalents (exactly the...

    Write a Java program to convert octal (integer) numbers into their decimal number equivalents (exactly the opposite of what you have done in Assignment 4). Make sure that you create a new Project and Java class file for this assignment. Your file should be named “Main.java”. You can read about octal-to-decimal number conversions on wikepedia Assignment 4 is at the bottom Objective Your program should prompt the user to enter a number of no greater than 8 digits. If the...

  • Write a Java program to read customer details from an input text file corresponding to problem...

    Write a Java program to read customer details from an input text file corresponding to problem under PA07/Q1, Movie Ticketing System The input text file i.e. customers.txt has customer details in the following format: A sample data line is provided below. “John Doe”, 1234, “Movie 1”, 12.99, 1.99, 2.15, 13.99 Customer Name Member ID Movie Name Ticket Cost Total Discount Sales Tax Net Movie Ticket Cost Note: if a customer is non-member, then the corresponding memberID field is empty in...

  • Programming Assignment Objective Write a Java program that utilizes multiple classes. Write a Java program that...

    Programming Assignment Objective Write a Java program that utilizes multiple classes. Write a Java program that utilizes inheritance in a practical manner. Problem: Quiz Bowl Your high school quiz bowl team has been losing its edge and needs to find a method to improve. Knowing that you are a savvy programmer, your coach asks you to write a program that the team members can use to hone their skills. Quiz Bowl questions come in three varieties: True/False Multiple Choice (variable...

  • Please write it in Java language 2. (Myinterface.java) The program description below was found waaaaay back...

    Please write it in Java language 2. (Myinterface.java) The program description below was found waaaaay back in the archives of the Equinox history database. It is the specification for a simply "computer store storefront". Even though computer stores are now extinct, you find the idea charming and decide to use the specification as inspiration to write an interface for one of the Equinox systems. Read carefully: write your own GUI for one of the Equinox systems, drawing inspiration from the...

  • THIS MUST BE DONE ON VISUAL STUDIO Write a C# program that computes a the cost...

    THIS MUST BE DONE ON VISUAL STUDIO Write a C# program that computes a the cost of donuts at your local Rich Horton’s store. The cost, of course, depends on the number of donuts you purchase. The following table gives the break down: Donuts Purchased Cost per Donut ($) = 15 0.75 A customer can save on the HST (13%) if they buy 12 or more donuts so only charge HST (use a constant) on the purchase if the customer...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT