Question: Java 1. Write the following static methods. Assume the reference variable input for the Scanner class and any global variables mentioned are already declared. Use

Java

1. Write the following static methods. Assume the reference variable input for the Scanner class and any global variables mentioned are already declared. Use printf.

a. A method called tickets() that prompts for the number of tickets to be purchased and stores it in a global variable called noOfTickets. Think about the data type.

b. Overload the method coded in 1a above so that it accepts the number of tickets and the price for a ticket through its parameter list, and returns the cost for the ticket(s). No prompts are needed.

c. A value-receiving method that accepts the cost for a ticket purchase and adds it to a global variable called monthlyFun.

d. A method that accepts yearlyFun and yearlyFunBudget through its parameter list and tests to see if yearlyFun is over-budget, under-budget, or on-budget. If it is over-budget return the message Way too much fun! Over-budget!; under-budget return Little more fun! Under-budget!; and on-budget Just the right fun! On-budget!. No prompts are needed.

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!