Task#1 //Error-Correction in the following program /** The java program is error -free program…

Task#1

//Error-Correction in the following program

/**

The java program is error -free program that prints the

average of two numbers and temperature values.

Errors are corrected in the program.

*/

public class NumericTypes

{

public static void main (String [] args)

{

//identifier declarations

final int NUMBER = 2 ; // number of scores

//Change the data type of SCORE1 and SCORE2 to double data type

final double SCORE1 = 100; // first test score

final double SCORE2 = 95; // second test score

final int BOILING_IN_F = 212; // boiling point in Fahrenheit

//Data type correction.

//Change the data type of the fToc to double

double fToC; // temperature in celsius

double average; // arithmetic average

String output; // line of output to print out

// Error correction1:

//avearage=(score1+score2)/number

average = (SCORE1 + SCORE2 )/ NUMBER;

output = SCORE1 + ” and ” + SCORE2 + ” have an average of “

+ average;

System.out.println(output);

// Convert Fahrenheit temperatures to Celsius

//Change the values of 9 and 32 to double type

// by writing as 9.0 and 32.0 that becomes as double types

fToC = 5/9.0 * (BOILING_IN_F – 32.0);

output = BOILING_IN_F + ” in Fahrenheit is ” + fToC

+ ” in Celsius.”;

System.out.println(output);

}

}

Task#2

/*The java program that prompts the user to enter

* the score1 and score2 and find the average

* value and print the average and prompts

* the user to enter the celcius and convert

* to the fahrenheit */

//NumericTypes.java

import java.util.Scanner;

public class NumericTypes

{

public static void main (String [] args)

{

//Create an object of Scanner class

Scanner scanner=new Scanner(System.in);

//identifier declarations

final int NUMBER = 2 ; // number of scores

final double SCORE1 ;

final double SCORE2 ;

final int BOILING_IN_F = 212; // boiling point in Fahrenheit

double fToC; // temperature in celsius

double average; // arithmetic average

String output; // line of output to print out

System.out.println(“Enter SCORE1: “);

//read score1 from user and convert the string to integer

//using Integer.parseInt method

SCORE1=Integer.parseInt(scanner.nextLine());

System.out.println(“Enter SCORE2: “);

//read score1 from user and convert the string to integer

//using Integer.parseInt method

SCORE2=Integer.parseInt(scanner.nextLine());

// Find an arithmetic average

average = (SCORE1 + SCORE2 )/ NUMBER;

output = SCORE1 + ” and ” + SCORE2 + ” have an average of “

+ average;

System.out.println(output);

// Convert Fahrenheit temperatures to Celsius

fToC = 5/9.0 * (BOILING_IN_F – 32.0);

output = BOILING_IN_F + ” in Fahrenheit is ” + fToC

+ ” in Celsius.”;

System.out.println(output);

//declare a celcius

double celcius;

System.out.println(“Enter temperature in Celsius”);

//read celcius and convert to double type

celcius=Double.parseDouble(scanner.nextLine());

//Convert celcius to the fahrenheit

double cToF=celcius *(9/5.0) + 32.0;

output = celcius + ” in Celsius is ” + cToF

+ ” in Fahrenheit”;

//print celcius temperature to fahrenheit

System.out.println(output);

} //end of the main method

}//end of the class

Task#2 Alternative

/**

This program demonstrates how numeric types and

operators behave in Java.

*/

import java.util.Scanner;

import java.lang.Math;

public class NumericTypes

{

public static void main (String [] args)

{

// TASK #2 Create a Scanner object here

Scanner in = new Scanner(System.in);

// (not used for alternate)

// Identifier declarations

final int NUMBER = 2 ; // Number of scores

final int SCORE1 = 100; // First test score

final int SCORE2 = 95; // Second test score

final int BOILING_IN_F = 212; // Boiling temperature

int fToC; // Temperature Celsius

double average; // Arithmetic average

String output; // Line of output

// TASK #2 declare variables used here

// TASK #3 declare variables used here

// TASK #4 declare variables used here

String firstName;

String lastName;

String fullName;

char firstNameInit;

double radius;

double area;

double volume;

// Find an arithmetic average.

average = (SCORE1 + SCORE2) / NUMBER;

output = SCORE1 + ” and ” + SCORE2 +

” have an average of ” + average;

System.out.println(output);

// Convert Fahrenheit temperature to Celsius.

fToC = 5/9 * (BOILING_IN_F – 32);

output = BOILING_IN_F + ” in Fahrenheit is ” +

fToC + ” in Celsius.”;

System.out.println(output);

System.out.println(); // To leave a blank line

// ADD LINES FOR TASK #2 HERE

// Prompt the user for first name

// Read the user’s first name

// Prompt the user for last name

// Read the user’s last name

// Concatenate the user’s first and last names

// Print out the user’s full name

System.out.print(“Enter Your First Name: “);

firstName = in.nextLine();

System.out.print(“Enter Your Last Name: “);

lastName = in.nextLine();

fullName = firstName + ” “+ lastName;

System.out.println(“Full Name: “+fullName);

System.out.println(); // To leave a blank line

// ADD LINES FOR TASK #3 HERE

// Get the first character from the user’s first name

// Print out the user’s first initial

// Convert the user’s full name to uppercase

// Print out the user’s full name in uppercase

firstNameInit = firstName.charAt(0);

System.out.println(“First Name initial: ” + firstNameInit);

fullName = fullName.toUpperCase();

System.out.println(“Full Name in UpperCase : “+fullName);

System.out.println(); // To leave a blank line

// ADD LINES FOR TASK #4 HERE

// Prompt the user for a diameter of a sphere

// Read the diameter

// Calculate the radius

// Calculate the volume

// Print out the volume

System.out.print(“Enter Radius of sphere: “);

radius = in.nextDouble();

area = Math.PI * Math.pow(radius,2);

volume = (4/3.0) * Math.PI * Math.pow(radius,3);

System.out.println(“Sphere area: “+area);

System.out.println(“Sphere Volumen: “+volume);

}

}

Task#3

/**The java program that intialize the firstName and lastName.

* Get the intial from the firstName using charAt method and concatenate

* the intial with lastName and print the lenght of the name*/

//StringExercise.java

public class StringExercise

{

public static void main(String[] args)

{

//declare a character variable

char firstInitial;

//declare a string variables

String firstName;

String lastName;

//set firstName and lastName values

firstName=”Edward”;

lastName=”William”;

//Get initial from the firstName

firstInitial=firstName.charAt(0);

//convert the last name to the

//upper case

lastName=lastName.toUpperCase();

//Concatenate fhe firstInitial

//with last name

System.out.print(“Name : “);

System.out.println((firstInitial+” “).concat(lastName));

System.out.print(“Lenght of the name : “);

System.out.print((firstInitial+” “).concat(lastName).length());

}//end of the main

}//end of the class

Task#4

/**The java program that prompts the user to enter the

* diameter of the sphere and calculate the volume

* of the sphere and prins the volume*/

//Formula.java

import java.util.Scanner;

public class Formula

{

public static void main(String[] args)

{

//Scanner object

Scanner scanner=new Scanner(System.in);

//Declare double variables diameter and volume

double dia;

double volume;

System.out.println(“CALCULATION OF VOLUME OF SPHERE”);

System.out.println(“Enter diameter of sphere : “);

//read diamter of the sphere

dia=Double.parseDouble(scanner.nextLine());

//calculate the radius of the sphere

double radius=dia/2;

//find the volume of the sphere

volume=(4/3.0)*Math.PI*Math.pow(radius, 3.0);

//print the volume of the sphere

System.out.println(“Volume of the sphere : “+volume);

}//end of the main

}//end of the class

Task#5

import java.util.*;

public class Mileage

{

public static void main(String[] args)

{

Scanner input = new Scanner(System.in);

System.out.println(“This program will calculate mileage”);

System.out.println(“No of miles driver: “);

double miles = input.nextDouble();

input.nextLine();

System.out.println(“No of gallons used: “);

double gallons = input.nextDouble();

input.nextLine();

System.out.println(“Miles per gallon: “+(miles/gallons)+” miles/gallons”);

}

}

Task#6

/**

* Below program calculates sum of two integer variables a and b and

* store it in another variable named sum and then sum is printed.

*

* Name: Your name here.

* Date: 30-01-2021

*/

public class Main

{

public static void main(String[] args)

{

int a = 4; // int variable a stores an integer value.

int b = 6; // int variable b stores another integer value.

int sum = a + b; // int variable sum stores the sum of a and b.

// Below statement prints the sum of a and b.

System.out.println(“Sum of a and b is: ” + sum);

}

}

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with MyhomeworkGeeks
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
History
Don't really see any of sources I provided, but elsewise its great, thank you!
Customer 452697, May 8th, 2021
Business Studies
Thank you very much for a good job done and a quick turn around time.
Customer 452615, March 31st, 2021
Human Resources Management (HRM)
My son and I have been sick for two weeks, of course at the end of my semester. I am so grateful that myhomeworkgeeks were able to help! Both papers got A's and I couldn't be more thrilled! Thank you so much and don't forget to tip your writer!
Customer 453077, February 22nd, 2022
Business Studies
Paper is great. Just only needed the one reference. Thank you
Customer 453139, May 4th, 2022
History
Thank you. No issues
Customer 453139, April 17th, 2022
Nursing
Thank you
Customer 453087, March 5th, 2022
Management
It was gotten well after time I needed to make needed additions, but it is something that did help me. I could not get the concept of ho to start such a project but now reading this, I was over thinking the project it seems.
Customer 452801, July 19th, 2021
Human Resources Management (HRM)
I finished the first deliverable of a project presentation but had no time to finish my second deliverable. The writer revamped my first deliverable and made it much more appealing! Not only was I impressed with the content but I was so grateful for the time they took to redo the background. I have been under a lot of pressure at work and at home so this has been a great service when I have had little time! I appreciate the detail and help! Always on time and always exceeding expectations!
Customer 453077, April 5th, 2022
Business and administrative studies
awesome job
Customer 453201, June 24th, 2022
Nursing
thank you so much
Customer 452749, June 10th, 2021
Humanities
Thank youuuu
Customer 452729, May 30th, 2021
English 101
great summery in terms of the time given. it lacks a bit of clarity but otherwise perfect.
Customer 452747, June 9th, 2021
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend
OUR GIFT TO YOU
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat
Live ChatWhatsApp

Are You Looking For Assignment Help? We Can Certainly Assist You