Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java only please Purpose Working with Wrapper classes General Information In thi

ID: 3702893 • Letter: J

Question

Java only please

Purpose Working with Wrapper classes General Information In this lab assignment, you need to use methods of at least two API wrapper classes to complete the code Provided Resources 1. 2. 3. Lab 12 Instructions, including requirements The code shell (Lab12.java) Sample output Requirements Complete the printf statements to provide the required output. Do not changes any provided variable declarations. Do not add any variable declarations to the code Use API wrapper class methods to complete the printf statements In one case, you will need to cast a result into the proper type in order for the printf statement to process correctly Grading If your program compiles clearly and functions exactly as required, your grade will be 100%. Otherwise, it will be 0% Expected Output Following is a sample of expected output when you run Lab12.java The sum of firstInteger plus secondInteger is: 1015 The difference of secondInteger less firstInteger is: 287 The result of dividing firstInteger by secondInteger is: 0.559140 The sum of firstDouble plus secondDouble is: 1624.570000 The difference of firstDouble less secondDouble is: 1249.090000 The result of dividing firstDouble by secondDouble is: 7.653297

Explanation / Answer

Lab12.java

public class Lab12

{
public static void main( String[] args )
{

String firstInteger = "364";
String secondInteger = "651";
  
String firstDouble = "1436.83";
String secondDouble = "187.74";
  
  
// Output the results of firstInteger + secondInteger.
System.out.printf( "The sum of firstInteger plus secondInteger is: %d%n",Integer.parseInt(firstInteger)+Integer.parseInt(secondInteger));
// Output the results of secondInteger - firstInteger.
System.out.printf( "The difference of secondInteger less firstInteger is: %d%n",Integer.parseInt(secondInteger)-Integer.parseInt(firstInteger));
// Output the results of firstInteger / secondInteger. NOTE: the output MUST include the DECIMAL PORTION of the result.
System.out.printf( "The result of dividing firstInteger by secondInteger is: %f%n",((double)Integer.parseInt(firstInteger))/Integer.parseInt(secondInteger));
  
// Output the results of firstDouble + secondDouble.
System.out.printf( "The sum of firstDouble plus secondDouble is: %f%n",Double.parseDouble(firstDouble)+Double.parseDouble(secondDouble));
// Output the results of firstDouble - secondDouble.
System.out.printf( "The difference of firstDouble less secondDouble is: %f%n",Double.parseDouble(firstDouble)-Double.parseDouble(secondDouble));
// Output the results of firstDouble / secondDouble. NOTE: the output MUST include the DECIMAL PORTION of the result.
System.out.printf( "The result of dividing firstDouble by secondDouble is: %f%n",Double.parseDouble(firstDouble)/Double.parseDouble(secondDouble));
  
}  
}

_____________________

Output:

The sum of firstInteger plus secondInteger is: 1015
The difference of secondInteger less firstInteger is: 287
The result of dividing firstInteger by secondInteger is: 0.559140
The sum of firstDouble plus secondDouble is: 1624.570000
The difference of firstDouble less secondDouble is: 1249.090000
The result of dividing firstDouble by secondDouble is: 7.653297

______________Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote