Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

package arraypractice; import java.util.Scanner; public class ArrayPractice { /* * */ static int admissionFee = 300; static Scanner get = new Scanner(System.in); static int selection

package arraypractice; import java.util.Scanner; public class ArrayPractice { /* * */ static int admissionFee = 300; static Scanner get = new Scanner(System.in); static int selection = 0; public static void main(String[] args) { //social security,first name, last name,age,weight , and glucose reading int choice = 0; //start of while loop while(true) { System.out.println("Do you have a GPA of a 2.0 or greater? " + "1 - Yes " + "2 - No"); System.out.println("Please enter your selection:"); choice = get.nextInt(); if(choice == 2) { System.out.println("Sorry you have to have a gpa of 2.0 or better."); } else if(choice == 1) { System.out.println("Perfect, which sports would you like to play ?"); System.out.println("-1- Basketball " + "-2- Baseball " + "-3- Football " + "Please enter your selection:"); choice = get.nextInt(); } { switch(choice) { case 1: basketballInput(); break; case 2: baseballInput(); break; case 3: footballInput(); break; } // ask if student wants to add another sport System.out.println("Would you like to add another sport for this year? " + "-1- Yes " + "-2- No "); selection = get.nextInt(); if(selection == 2) { System.out.println("Goodluck this year!"); admissionTotal(admissionFee); break; } } } }////////////////////////////////////////////////////////////end main //======================================Start of Basketball input private static int basketballInput() { double height = 0.0; System.out.println("How tall are you?"); System.out.println("Please enter your height:"); height = get.nextDouble(); if(height < 5.9) System.out.println("Sorry you are not eligible to play"); else if(height != 5.9) System.out.println("You are eligible to play and your admission fee is: " + admissionFee); return admissionFee; }//============================end of basketball input //====================================================start of baseball input private static int baseballInput() { System.out.println("What position would you like to play ? "); String position = get.next(); System.out.println("You have chosen to play: " + position); System.out.println("You are eligible to play and your admission fee is: " + admissionFee); return admissionFee; }//==============================================================================end of baseball input private static int footballInput()//====================================================================start of football input { System.out.println("What position would you like to play ? "); String position = get.next(); System.out.println("You have chosen to play: " + position); System.out.println("You are eligible to play and your admission fee is: " + admissionFee); return admissionFee; }//==================================================================================================================================end of footballinput public static void admissionTotal(int admissionFee) { int yourTotalAdmission = 0; yourTotalAdmission = admissionFee; System.out.println("Your total admission for the school year is: " + yourTotalAdmission); } }//end class array

Question: How do I create a variable that will add the ending admission fee?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

what are the provisions in the absence of Partnership Deed?

Answered: 1 week ago

Question

1. What is called precipitation?

Answered: 1 week ago

Question

1.what is dew ?

Answered: 1 week ago