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
-
Three activities are candidates for crashing on a project network for a large computer installation (all are, of course, critical). Activity details are in the following table: (a) What action would...
-
Show what will happen to the diagram above as a result of the changes listed. a. The firm's budget increases. b. The price of Y decreases. c. The price of X decreases. d. Y becomes more expensive,...
-
Which of the following is not likely to be covered within an audit charter prepared for an organization's information systems audit function? a. Information systems audit function's place within the...
-
The following data were available from the records of the Hegge Department Store for the year ended December 31, 2007: Required Using the retail method, what is the estimate of the merchandise...
-
A farmer is preparing to plant corn and expects to deliver his crop to the market in 1 year. The yield on US t - bills is 5 % and it costs 0 . 5 % to store corn for 1 year. If the spot price of corn...
-
Lunatics, an e-commerce sports company wants to buy Rowdy Trading Cards at a cost of $504 million. Rowdy will operate for 20 years. They expect annual cash flows from operations to be $70.1 million...
-
How many carrots have a length of more than seven and three fourths but less than eight and three fourths? A set of data showing the length of carrots in inches. The data includes the following...
-
You are considering two options of scholarship to fund your degree program for the next three years. There are two scholarship offers that you are eligible to apply for. Each of the scholarship...
-
Complex Simplicity Inc. paid a net price of $234,500 for a shipment of bulk microprocessors. The trade discount offered was 15%. a. Calculate the list price of the shipment. b. Calculate the dollar...
-
Review the following workplace budget for Handsome Health. Compare the actual performance to date with the target figures. Identify any variances of the budget figures, and draft a report to your...
-
You are asked to design a digital logic circuit that has three inputs A, B and C and two outputs X and Y. The behavior of the circuit is given by the truth table shown. Write the sum of products...
-
Quality home made ice cream has plans to pay decreasing annual dividends of $2, $1.50, and $1 over the next three years, respectively. After that, the firm will increase the dividend by 4 percent...
-
Consider a random sample X1, X2, ..., X from a location scale family with density function: 1(2,14, 0) = 1-1 (="). f(x, == f where and are the location and scale parameters, respectively a. Show that...
-
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
-
An organization with a mission to build is in rapid expansion and growth. An organization with a mission to harvest is in a mature market. Assuming compensation is based on each of the factors listed...
-
Repeat Example \(15-7\) except with a forced flow with a velocity of \(1.05 \mathrm{~cm} / \mathrm{s}\) past the sphere. Use Eq. (15-60b) to determine \(\mathrm{k}_{\mathrm{c}}\). The viscosity of...
-
Two identical large glass bulbs are filled with gases and connected by a capillary tube that is \(\delta=0.0100 \mathrm{~m}\) long. Bulb 1 at \(\mathrm{z}=0\) contains the following mole fractions:...
Study smarter with the SolutionInn App