hts.StevenWood.com

Assignment

Home ] Up ] Machine Code ] Simple Program ] Assignment 2-2 ] Syntax Errors ] Logic Errors ] [ Assignment ][ Last Page ]

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.  

 

  1. Write a Java Program Assign2a that will
    1. create a variable for name and another for age.
    2. set the values of the variable to your actual name and age.
    3. 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!"


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


    4. test your program by changing the values of the variable number1 and number2.


       
  3. Write a Java program Assign2c to calculate and print a bill of sale based on the following:
    1. Margaret  has purchased a blouse for 10.49 and paid the clerk with a $20.00 bill.
    2. assign variables for the purchase price and amount tendered.
    3. calculate taxes (GST 7%, PST 8%), total bill, and change using variables.
    4. 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.

 

 
Home ] Up ] Machine Code ] Simple Program ] Assignment 2-2 ] Syntax Errors ] Logic Errors ] [ Assignment ][Last Page]
All material on this site is copyright © 1997- by Steven Wood or as credited. All right reserved. Use of this site indicates you agreement with the  terms of use.
Send comments or questions to about this page.
Every attempt has been made to credit work under copyright. If there are any claims that copyright has been missed please contact the .
+SDG+