Unformatted text preview: http :/ /www-rohan.sdsu. edu/~masc05 OO/LECS 1 07/ f0 8hw3 .txt HOMEWORK #3 Write a Java program that simulates an on—line ticket processing website.
Your program should: 1. Output a message welcoming the user to your ticket—ordering company.
(Choose a name for your company.) 2. Ask the user for his or her name. 3. Ask the user how many movie tickets he or she wants to buy, at $9 per ticket.
4. Ask the user how many concert tickets he or she wants to buy,
at $20 per ticket.
5. Output the message, "Your order has been processed, USER'S—NAME"
(where USER'S—NAME is of course replaced by the actual name of the user,
as entered in Step 2).
Compute the dollar amount of the user's order.
Output the message, "Total order: $##"
(where ## is of course replaced by the amount computed in Step 6).
8. Your program should reside in a file named HW3.java . \10‘ THE PURPOSE OF THE ASSIGNMENT To give you practice:
(1) Using methods from sdsu.io.*, java.io.*, or java.util.*,
to read keyboard input.
(2) Using arithmetic operators to perform mathematical computations.
(3) Compiling a Java program, by using the javac command.
(4) Executing a compiled Java program by using the java command
followed by a class name. ON THE DUE DATE Submit a copy of your file HW3.java containing the source code for the Java program you wrote which meets the above specifications.
You can submit it on paper, or you can email it using the instructions
listed on this class website. TIPS Remember that values of "double" data type will output with a decimal.
Therefore, when the value is non—fractional, it will output as something
like 29.0, which will look awkward when outputted as the message "Total order: $29.0" You can fix this by using only integer data types in Homework #3, or by adding code to manually output an extra "0" character. (Java's more advanced output—formatting capabilities will be discussed later in the semester.) 10f] 12/11/2008 3:14 PM ...
View Full Document
- Fall '08