Question: Write a menu driven program that determines the cost of a new membership. Your program must contain a method that displays the general information about

Write a menu driven program that determines the cost of a new membership. Your program must contain a method that displays the general information about the fitness center and its charges, a method to get all the necessary information to determine the membership cost, and a method to determine the membership cost. Use appropiate parameters to pass information in and out of a method.

Here is my code: please help me find what i'm doing wrong.

package ch7; import java.util.*; /** * * @author Abby Rink */

public class Ch7 {

/** * @param args the command line arguments */ public static void main(String[] args) { basicInfo(); //get info int ch = getinfo(); displayCost(ch); } public static void basicInfo() { //display information System.out.println("basic information about fitness center"); System.out.println ("if you are a senior citizen 30% discount"); System.out.println("If you are already a member in this fitness center" + "and paid 12 months in advance then 15% discount is provided"); System.out.println("normal users don't get a discount"); System.out.println(""); } // get info method public static int getInfo() { System.out.println("Enter your choice: "); System.out.println("1.Enter if senior citizen"); System.out.println("2. if you are already a member"); System.out.println("3: if you have already purchased a membership" ); System.out.println("4:if you are a normal user" ); Scanner sr = new Scanner(System.in); // get choice int choice = sr.nextint(); return choice; } //implementing displayCost()

/** * * @param choice1 */ public static void displayCost(int choice1); { double cost = 8000, result1, result2, result3, result4; switch(choice1) { case 1: result1 = cost - (cost * 0.30); System.out.println("cost after discount is: " + result1); break; case 2: result2 = cost - (cost * 0.15); System.out.println("cost after discount is: "+ result2); break; case 3: result3 = cost - (cost * 0.20); System.out.println("cost after discount is: " + result3); break; case 4: result4 = cost; System.out.println("Cost is: " + result4); break; default: System.out.println("Enter only choices 1-4"); break; } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!