Write a program that computes the fare on the Copenhagen Transit system given two inputs from...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that computes the fare on the Copenhagen Transit system given two inputs from the user: • The zone number: 1 or more • The passenger type: adult or child Your prompts to the user must be : Enter zone number : Enter adult or child: The fare on Copenhagen Transit is specified as follows: If the zone is 2 or smaller and the ticket type is "adult," the fare is 23.0. . If the zone is 2 or smaller and the ticket type is "child," the fare is 11.5. . If the zone is 3 and the ticket type is "adult," the fare is 34.5. If the zone is 3 or 4 and the ticket type is "child," the fare is 23.0. . If the zone is 4 and the ticket type is "adult," the fare is 46.0. . If the zone is greater than 4, the fare is -1.00 (since your calculator does not handle inputs that high). Your output must be in the format: The fare for adultorChild to zone number zoneNumber is fare. A sample run of the program with inputs 3 and adult must look like: Enter zone number: 3 Enter adult or child: adult The fare for adult to zone number 3 is $34.50 Please note that your class should be named Copenhagen Transit. Write a program that asks the user for their age measured in days. The program must then compute the person's age in years and finally output one of the message that follow: (Note: For simplicity the program can ignore leap years and assume that all years have 365 days) If the user is: Exactly 1 year old or younger, print: "You are an infant" over 1 year old and is 3 years old or younger, print: "You are a toddler" over 3 years old and is 12 years old or younger, print: "You are a child" over 12 years old and is 19 years old or younger, print: "You are a teenager" over 19 years old and is 21 years old or younger, print: "You are a young adult" over 21 years old and is 50 years old or younger, print: "You are an adult" over 50 years old and is 65 years old or younger, print: "You are middle aged" over 65 years old, print: "You are a senior citizen" For three sample runs where the user enters 800, 10950, and 25550 the console screens must look as follows: Enter an age in number of days : 800 You are a toddler Enter an age in number of days : 10950 You are an adult Enter an age in number of days : 25550 You are a senior citizen Please note that your class should be named AgeLabel. Write a program that computes the fare on the Copenhagen Transit system given two inputs from the user: • The zone number: 1 or more • The passenger type: adult or child Your prompts to the user must be : Enter zone number : Enter adult or child: The fare on Copenhagen Transit is specified as follows: If the zone is 2 or smaller and the ticket type is "adult," the fare is 23.0. . If the zone is 2 or smaller and the ticket type is "child," the fare is 11.5. . If the zone is 3 and the ticket type is "adult," the fare is 34.5. If the zone is 3 or 4 and the ticket type is "child," the fare is 23.0. . If the zone is 4 and the ticket type is "adult," the fare is 46.0. . If the zone is greater than 4, the fare is -1.00 (since your calculator does not handle inputs that high). Your output must be in the format: The fare for adultorChild to zone number zoneNumber is fare. A sample run of the program with inputs 3 and adult must look like: Enter zone number: 3 Enter adult or child: adult The fare for adult to zone number 3 is $34.50 Please note that your class should be named Copenhagen Transit. Write a program that asks the user for their age measured in days. The program must then compute the person's age in years and finally output one of the message that follow: (Note: For simplicity the program can ignore leap years and assume that all years have 365 days) If the user is: Exactly 1 year old or younger, print: "You are an infant" over 1 year old and is 3 years old or younger, print: "You are a toddler" over 3 years old and is 12 years old or younger, print: "You are a child" over 12 years old and is 19 years old or younger, print: "You are a teenager" over 19 years old and is 21 years old or younger, print: "You are a young adult" over 21 years old and is 50 years old or younger, print: "You are an adult" over 50 years old and is 65 years old or younger, print: "You are middle aged" over 65 years old, print: "You are a senior citizen" For three sample runs where the user enters 800, 10950, and 25550 the console screens must look as follows: Enter an age in number of days : 800 You are a toddler Enter an age in number of days : 10950 You are an adult Enter an age in number of days : 25550 You are a senior citizen Please note that your class should be named AgeLabel.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Write a program that computes the fare on the Copenhagen Transit system given two inputs from the user: The zone number. The passenger type. Your prompts to the user must be : Enter zone number :...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
In Exercises solve the first-order differential equation by any appropriate method. y' = 2x1 - y
-
Prepare three ledger account forms like the one in Exhibit 9 for the following accounts: Cash (111), Accounts Receivable (113), and Service Revenue (411). Post the transactions that are recorded in...
-
A gas is compressed from an initial volume of 0.42 m3 to a final volume of 0.12 m3. During the quasi-equilibrium process, the pressure changes with volume according to the relation P + aV + b, where...
-
For each of the following, indicate whether the item is an adjustment to the bank balance or the book balance: 1. Bank service charge 2. Deposit in transit 3. Bank collection of amount due from...
-
Osteoporosis is a degenerative disease that primarily affects women over the age of 60. A research analyst wants to forecast sales of StrongBones, a prescription drug for treating this debilitating...
-
The weighted average cost of capital (WACC) is calculated using the firm's target capital structure together with its after-tax cost of long-term debt, after-tax cost of short-term debt, cost of...
-
On January 1, 2020, Wildhorse Leasing Inc., a lessor that uses IFRS 16, signed an agreement with Rock River Inc., a lessee, for the use of a compression system. The system cost $424,000 and Wildhorse...
-
Give a simple description (using the set builder notation) of the language generated by the grammar with productions S aaA A bS S A What language does the grammar with these productions generate?...
-
A U.S. grocery store entity is looking to take delivery of a product such as apples from the country of Chile that are for sale to U.S. customers with payment and delivery in six months. How can the...
-
What is Compensation surveys and why Compensation surveys are important?
-
Reflected light by the moon is diffuse, meaning that we can best model it as the bright side of the moon first absorbing sunlight, and then \"emitting\" the reflected part again. The albedo of the...
-
Your retirement goal is to have enough in savings to be able to pay yourself $150,000 per year for 20 years. If you expect to earn 4% on your savings during retirement, how much will you need in...
-
A CNC machining center was purchased 6 years ago for $100,000 and the company wants to know if it should be replaced. The current market value is $200,000, which will decline as follows over the next...
-
Bits and Bytes, Inc. (Bits) sells commercial servers, routers and other technology products in Nevada. In doing so, Bits' sales personnel solicit orders from customers, and the orders are sent to...
-
For the vector whose polar components are (Vr = 1, Vθ = 0), compute in polars all components of the second covariant derivative Vα;μ;ν. To find...
-
The growth of some bacteria populations can be described by N = Noekt where N is the number of individuals at time t, N0 is the number at time t = 0 , and k is a constant. Assuming the number of...
-
Evaluate the following indefinite integrals: (a) (b) dx
-
Define the variables x and y as x = 5.1 and y = 4.2, then evaluate: (a) 3/4 xy 7x/y2 + xy (b) (xy)2- x + y/(x-y)l2 + x + y/2x - y
-
Explain the differences among the following. a. Financial statement auditing. b. Compliance auditing. c. Operational auditing.
-
Explain the differences among the following. a. External auditors. b. Internal auditors. c. Government auditors.
-
Describe four elements of the theoretical framework of auditing.
Study smarter with the SolutionInn App