A3 [30 marks] Focus: arithmetic operators, Math class, printf () method Q1. [6 marks] The evaluation of the cold of our environment relies on several elements such as relative humidity, speed...

Java


A3 [30 marks] Focus: arithmetic operators, Math class, printf () method Q1. [6 marks] The evaluation of the cold of our environment relies on several elements such as relative humidity, speed of wind, and sunshine. To calculate the wind-chill temperature using wind and temperature, the formula below is used: Twc = 35.74 + 0.6215 ta - 35.75 v0.16 + 0.4275 ta v0.16 Here, v is the wind speed measured in mph and ta is the exterior temperature measured in degrees Fahrenheit. Develop a program that takes user input for wind speed of 2 or greater and temperature which is between -58 ºF and 41ºF and then calculates and prints the wind-chill temperature. Assume the user will always enter a valid value, i.e. within the correct range. Hint: You can use Math.pow (base value, power value). Sample run: Q2. [6 marks] Write a program that takes a real number as a user input and then prints the digits before and after the decimal point separately. Sample run: Note: accuracy of the output is not important. i.e. 2.4 could result in 2 and 0.399999 Q3. [6 marks] Write a program which asks user to input an integer number between 0 and 999 (inclusive) and then prints the sum of all the digits of that integer number. For example, for an integer number 346, the sum should be 3 + 4 + 6 = 13. Hint: You can use “%” and “/” operators to extracts digits of that integer. For example, 346 % 10 = 6 and 346 / 10 = 34. Sample run: Enter an integer between 0 and 999 (inclusive): 956 The sum of all digits in 956 is 20 Q4. [6 marks] Write a program that takes a number as an input from the user and then perform at least six operations on the given number using following operators:  Arithmetic operators (use 2)  Augmented assignment operator (use 2)  Increment and decrement operators (use one prefix and one postfix) Your program should show sample of using the selected operators and does not have to be a real world problem. Also, please add comments explaining how your operators works. Q5. [6 marks] Write a program which generates and prints a random valid license plate number. In order to be valid the license plate should have three randomly generated letters from ‘A’ to ‘Z’ , followed by four randomly generated digits from 0 to 9. For example: A random vehicle plate number: TFW4387 Submission Instructions For this assignment, you need to do the following: 1- Create a Java project of which name consists of your student number followed by the assignment number, e.g., “1234567_A1”. 2- Create one class for each question and write your answer inside that class. Your classes should have the same name as the question number (e.g., Q1) 3- After solving all questions, open Windows Explorer (or any other file explorer). 4- Navigate to your Java project folder (can be found inside your Eclipse workspace folder). 5- Locate the “src” folder for this project (the folder that includes the source code for all questions). 6- Zip the “src” folder and rename the zipped file to match your project name (e.g., 1234567_A1.zip). 7- Submit the zipped file to Canvas. Note that you can resubmit an assignment, but the new submission overwrites the old submission and receives a new timestamp.
Oct 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here