XXXXXXXXXXVA Teacher: Jaina Sheth Programming 1 Assignment - 02 Vanier College March 10, 2021 Deadline : 28th March, 2021 Time : 11:59 PM Marks: 60 Points Read the instructions carefully. 1 General...

1 answer below »
I have to do the 6 tasks with the visual studio code app. This is my first semester with programming. (Please follow the document I sent)



420-101-VA Teacher: Jaina Sheth Programming 1 Assignment - 02 Vanier College March 10, 2021 Deadline : 28th March, 2021 Time : 11:59 PM Marks: 60 Points Read the instructions carefully. 1 General Instructions • This work is an individual work and should satisfy expectation of originality. • Any form of plagiarism will not be tolerated. • You must submit a single .zip file for this assignment on Lea under 420-101-VA Assignment-02. • Place all your Java programs (.java files) directly in a folder with a name Lastname Firstname StudentID (e.g.,Sheth Jaina 2115533). Compress (zip) the folder and submit a .zip file only. There shouldn’t be any package folder or src folder inside the zipped folder. • You must not submit files with extensions such as a .rar, .tz, .7z, .java, .txt, etc. • If you submit a file other than .zip file, your submission will not be considered and you will be graded a straight 0. Also, if you submit multiple files, only the last submitted work will be considered. 2 Grading You will be graded out of 60 points according to the following distribution: • [10 points] 5 points for each of the tasks 1 and 2. • [20 points] 10 points for each of the tasks 3 and 4. • [30 points] 15 points for each of the tasks 5 and 6. 3 Tasks Write a Java program for each of the following. Design a generalized solution which can work for any valid value of variables. 1. Accept a floating point number as user input. Display the whole number portion of the floating point number on the screen. • For example, if we consider the number 154.62, the whole number portion is 154. If we consider the number 0.0623, the whole number portion is 0. • These are just examples. Your program should work for any valid floating point value, not just these two. 2. Accept a floating point value for temperature in Fahrenheit scale. Convert this value of temperature from Fahrenheit to Celsius degree and display the temperature in Celsius on the screen. • The formula for this conversion: C = 5 9 ∗ (F − 32) where F is value for temperature in Fahrenheit scale. • For example, if we consider the value for temperature in Fahrenheit scale to be 45.5, then the equivalent Celsius temperature value would be 7.5 using the given formula. • This is just an example. Your program should work for any valid floating point value for temperature in Fahrenheit scale, not just the given one. 3. Accept marks for a student for three different subjects out of 100 (as whole numbers). Calculate his total marks and average of three subjects. Display both of them on the screen. 4. Accept a number as user input. Check if the number is odd or even using the ternary operator. Display the result on the screen as either “The given number is odd.” or “The given number is even”. 5. Accept a 3-digit whole number as user input and display the number on the screen. Reverse this 3-digit number using operators and display reversed number on the screen. • For example, if we consider the number 178, the reversed number will be 871. • This is just an example. Your program should work for any valid 3-digit whole number, not just the given one. Page 2 6. Accept floating point values for the following variables as user input: • mealCost • tipPercent First, calculate the value for the variable totalTip using the accepted values. Then, calculate the value for the variable totalBill. Display all four values on the screen. • For example, if we consider the value of the variable mealCost to be 40.00 and the value of the variable tipPercent to be 15.50; the totalTip will be 6.20 and the totalBill will be 46.20 after the calculations. • This is just an example. Your program should work for any valid floating point values for mealCost and tipPercent, not just the given one. Page 3 General Instructions Grading Tasks
Answered 1 days AfterMar 27, 2021420-101-VA

Answer To: XXXXXXXXXXVA Teacher: Jaina Sheth Programming 1 Assignment - 02 Vanier College March 10, 2021...

Sudipta answered on Mar 29 2021
148 Votes
average.java
average.java
import java.util.Scanner;
public class average {
    public static voi
d main(String[] args) {
        Scanner sc = new Scanner (System.in);
        System.out.print("Enter first subject marks: ");
        double num1=sc.nextDouble();
        System.out.print("Enter second subject marks: ");
        double num2=sc.nextDouble();
        System.out.print("Enter third subject marks: ");
        double num3=sc.nextDouble();
        double marks=num1+num2+num3;
        double avg= marks/3;
        System.out.println("Total marks: "+marks);
        System.out.println("Average marks: "+avg);
    }
}
bill.java
bill.java
import java.util.*;
public class bill {
    public static void main(String[] args) {
        Scanner sc = new Scanner (System.in);
        System.out.print("Enter Meal Cost: ");
        float mealCost=sc.nextFloat();
    ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here