|
| |
Assignment 2-2
For each of the following, be sure use the proper headings, indentation and
internal comments.
All assignments must have the following comment headings:
|
/*
|
Name
:
|
|
Due Date :
|
|
Program Name :
|
|
Description :
|
|
*/
|
|
Save the .java and .class files in your work directory, compile and test.
- Write a Java Program Assign2a that will
- create a variable for name and another for age.
- set the values of the variable to your actual name and age.
- print a sentence which includes the variables:
Hello <name>, you look much older than <age>!
e.g. "Hello, Aaron Wood, you look much older than 15!"

- Write a Java Program Assign2b that will
- create variables named number1, number 2 and answer.
- set the values of the variable number1 and number 2 to some arbitrary
numbers (make up some numbers).
for example:
number1 = 50
number2 = 300
- print out the value of number1 "+" value of number2
"=" value of answer.
- test your program by changing the values of the variable number1 and
number2.

- Write a Java program Assign2c to calculate and print a bill of sale based
on the following:
- Margaret has purchased a blouse for 10.49 and paid the clerk
with a $20.00 bill.
- assign variables for the purchase price and amount tendered.
- calculate taxes (GST 7%, PST 8%), total bill, and change using
variables.
- output the entire bill showing purchased price, taxes and total. The
output should be formatted in a manner similar to what is shown below.
Hint: Use the special printing character information.
When completed, email the .java files
Check the Late
Submissions policy.
|