Write a Java application named Hw1_1.java that reads your full name and your major and print out he/she is taking which major. Here is a sample of the program’s behavior:
Enter your full name: Soories (user input)
Enter your major: Computer Science (user input)
(program output)
Soories is taking Computer Science major
Write a Java application named Hw1_2.java that converts your home country currency to US dollars. Please check on the Internet for the rate. Note: the program reads your currency value from the user as a floating-point value.
Ex: Converting from US dollars to Canadian dollars (1 US dollar = 1.19 Canadian dollar). So if I want to convert 10 US dollars to Canadian dollars, it should be 10 * 1.19 = 11.9) Here is a sample of the program’s behavior:
Enter your home country currency amount: 10 (user input)
10 US dollars = 11.8 Canadian dollars (program output)
Write a Java application named Hw1_3.java that solve this mathematic problem: A bag contains five $1 bills, two $5 bills, and one $10 bill. If one bill is drawn from the bag, what is the expected value of that draw? (Do not consider whether that currency amount is available on one bill for the solution, i.e., simply compute the mathematical answer with two decimal places.)
Solution:
Total bills = 5 ($1 bills) + 2 ($5 bills) + 1 ($10 bills) = 8
Total money = (5 * 1) + (2 * 5) + (1 * 10) = 5 + 10 + 10 = 25
The expected value of the draw = 25 / 8 = 3.13
Here is a sample of the program’s behavior:
Enter the number of $1 bills: 5 (user input)
Enter the number of $5 bills: 2 (user input)
Enter the number of $10 bills: 1 (user input)
(program output)
The expected value of the draw is 3.13