There are 3 types of train tickets: - yellow zone y-ticket: $10 each - blue zone...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
There are 3 types of train tickets: - yellow zone y-ticket: $10 each - blue zone b-ticket: $15 each - red zone r-ticket: $30 each Write a function to display the cost of train ticket like the following examples. Note that you only need to put the code of the function in the answer box and nothing else (do NOT put other code of the class in the answer box). For example: Test ticketCost (5, 1, 2); Result The ticket cost is y-tickets: 5 x $10 = $50 b-tickets: 1 x $15 = $15 r-tickets: 2 x $30 = $60 Total: $50 + $15 + $60 = $125 ticketCost(0, 10, 1); The ticket cost is y-tickets: 0 x $10 = $0 b-tickets: 10 x $15 = $150 r-tickets: 1 x $30 = $30 Total: $0 + $150 + $30 = $180 2 3 System.out.println("The ticket cost is ")%;B 4 System.out.println("y-tickets : + yTicket + x $10 = " 5 System.out.println("b-tickets : + bTicket + x $15 = 6 System.out.println("r-tickets : + rTicket + x $30 = 7 System.out.println("Total: $" + costofYTickets + " Answer: (penalty regime: 0 %) Reset answer 1 public static void ticketCost(int yTicket, int bTicket, int rTicket) { int totalCost = costofYTickets + costOfBTickets + costOfRTickets; " " + costofYTickets); + costOfBTickets); + costOfRTickets); " " + $ + costOfBTickets + +$" + costOfRTickets + = $' + total Cost); 8 9 10 There are 3 types of train tickets: - yellow zone y-ticket: $10 each - blue zone b-ticket: $15 each - red zone r-ticket: $30 each Write a function to display the cost of train ticket like the following examples. Note that you only need to put the code of the function in the answer box and nothing else (do NOT put other code of the class in the answer box). For example: Test ticketCost (5, 1, 2); Result The ticket cost is y-tickets: 5 x $10 = $50 b-tickets: 1 x $15 = $15 r-tickets: 2 x $30 = $60 Total: $50 + $15 + $60 = $125 ticketCost(0, 10, 1); The ticket cost is y-tickets: 0 x $10 = $0 b-tickets: 10 x $15 = $150 r-tickets: 1 x $30 = $30 Total: $0 + $150 + $30 = $180 2 3 System.out.println("The ticket cost is ")%;B 4 System.out.println("y-tickets : + yTicket + x $10 = " 5 System.out.println("b-tickets : + bTicket + x $15 = 6 System.out.println("r-tickets : + rTicket + x $30 = 7 System.out.println("Total: $" + costofYTickets + " Answer: (penalty regime: 0 %) Reset answer 1 public static void ticketCost(int yTicket, int bTicket, int rTicket) { int totalCost = costofYTickets + costOfBTickets + costOfRTickets; " " + costofYTickets); + costOfBTickets); + costOfRTickets); " " + $ + costOfBTickets + +$" + costOfRTickets + = $' + total Cost); 8 9 10
Expert Answer:
Posted Date:
Students also viewed these programming questions
-
Required: Zeda Incorporated, a U.S. MNC, is considering making a fixed direct investment in Denmark. The Danish government has offered Zeda a concessionary loan of DKK14,150,000 at a rate of 4...
-
Score: 2/30 1/10 answered Question 6 American Airlines' flights from Boston to Seattle are on time 50% of the time. Suppose 9 flights are randomly selected, and the number on-time flights is...
-
A company produced 5,000 units of a product in January and incurred $20,000 in manufacturing costs. If the company produced 6,000 units in February and experienced a 25% increase in manufacturing...
-
The people on Coral Island buy only juice and cloth. The CPI market basket contains the quantities bought in 2016. The average household spent $60 on juice and $30 on cloth in 2016 when the price of...
-
In a study published in the American Journal of Psychiatry (157:737744, May 2000), researchers wanted to measure the effect of alcohol on the development of the hippocampal region in adolescents. The...
-
Indicate whether each statement is true or false: (a) A solute will dissolve in a solvent if solutesolute interactions are stronger than solute-solvent interactions. (b) In making a solution, the...
-
The receiving department at Culp Electronics Company processes inventory deliveries upon arrival by means of online data terminals located on the receiving dock. Each inventory receipt entered into...
-
The duller Edge Inc. assembles and sells MP3 players. The company began operations on May 1, 2012, and operated at 100 % of capacity during the first month. The following data summarize the results...
-
refers to a record of the financial transactions of a given activity showing the receipts, expenditures, transfers, adjustments, and balances for the activity's account
-
Kofi Allon, who is 32 years old and single, is employed as a technical consultant for a large electronics distributor. He lives at 678 Birch Street, LaMesa, CA 91941. Kofi's Social Security number is...
-
How is forgone interest calculated? Explain
-
How can HR professionals ensure that training is inclusive and accessible to all employees?
-
How do social institutions like family, education, religion, and the economy perpetuate or challenge patterns of inequality, socialization, and collective identity formation across diverse cultural...
-
Assess how digital technologies, including social media and big data, can be utilized to enhance communication between government agencies and the public. Discuss the potential barriers to effective...
-
You are working with an endurance athlete who is acyclist. He weighs 160 lbs and is two days away from his100-mile race. He is currently on a 2,800 calorie diet andhis carbohydrates make up 70% of...
-
An Investor starts with One million Euros and converts it to 694,500 Pounds, which is then invested for one year. In a year the Investor has 736,170 Pounds, which she then converted back to Euros at...
-
Sarah is self-employed and made $7,500,000 in one year. She hires her friend Tom and pays him a salary of $325,000 annually. What is Sarah's taxable income and tax liability? Please include...
-
The production budget of Artest Company calls for 80,000 units to be produced. If it takes 30 minutes to make one unit and the direct labor rate is $16 per hour, what is the total budgeted direct...
-
Comparative stockholders' equity sections from two successive years of balance sheets from Farrow, Inc., are as follows: No dividends were declared or paid during 2018. Required Prepare the journal...
-
The stockholders' equity accounts of Raymund Corporation as of January 1 appear below: During the year, the following transactions occurred: June 7 Declared a 20 percent stock dividend; market value...
-
The stockholders' equity of Carly Corporation at January 1 follows: The following transactions, among others, occurred during the year: June 18 Declared a 70 percent stock dividend on all outstanding...
Study smarter with the SolutionInn App