Problem 1

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

Problem 2

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)

Problem 3

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
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.