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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started