$24
For this homework assignment, you will be writing a “Hello World” Program, but with some extra lines of output, asking for user input, and performing arithmetic operations on ints and doubles.
First, you must set up your Ubuntu environment (see class slides).
Second, you must write a program, called “abc1234_Hello_World_1.cpp” (replace abc1234 with your netid) that does the following:
Say “Hello User” to the user when the program is created
Ask the user for their name
Take their name as input
Thank the user by name for telling you their name
Ask for two numbers (ints)
Show the Sum of these two numbers as an int
Show the Difference of these two numbers as an int (Num1 – Num 2)
Show the Product of these two numbers as an int
Show the Quotient of these two numbers as an int (Num 1 / Num 2)
Ask for two more numbers (doubles)
Show the Sum of these two numbers as a double
Show the Difference of these two numbers as a double (Num1 – Num 2)
Show the Product of these two numbers as a double
Show the Quotient of these two numbers as a double (Num 1 / Num 2)
Thank the user “by name” for their time
Bonus (10 pts)
Create a second file called “abc1234_ Hello_World_2.cpp”. This will do the exact same thing as above, but with one main difference. You will not ask for the user’s name. Instead, you must figure out the user’s name by some other means. It is acceptable to be a user name, proper name, or some other identifying name for that person. The name cannot be hard-coded in the source file. Test your program in two different user accounts (create a 2nd account on your Ubuntu copy with different profile information) and see if it works.
Deliverables
You will submit your code and screen shots of your code working via Blackboard. You will upload a ZIP file, named “abc1234_HW1.zip”, containing 2 files (5 if you did bonus):
abc1234_Hello_World_1.cpp (source code)
abc1234_Hello_World_1.png (screen shot of program running)
abc1234_Hello_World_2.cpp (source code)
abc1234_Hello_World_2a.png (screen shot of program running with first user)
abc1234_Hello_World_2b.png (screen shot of program running with second user)
When you submit your file, leave the GTA instructions on how to compile your code and run it. Note: he will be using terminal on the virtual machine that I used in class. Instructions can be included as a comment on blackboard or in a README.txt file.
Full credit files named incorrectly result in a loss of 5 points each. Bonus files named incorrectly will result in a loss of 1 bonus point each.
For information on taking screen shots and creating zip files in Ubuntu, see the class resources section in Blackboard.