Can you please help me with this problem Statement in Java. Please provide me a
ID: 3884509 • Letter: C
Question
Can you please help me with this problem Statement in Java. Please provide me a screenshot before you run the code
For this assignment, you will create a program that demonstrates the use of numbers, strings, and methods.
Numbers:
a) Create variables to store any 2 floating-point numbers.
b) Create variables to store any 2 integral numbers.
Strings:
a) Create String variables to store your first name and your last name. Calculate, store and print your full name
b) Create a String variable to store your nationality and print it to the console.
Methods:
a) Create a method that will add the numbers stored in the 2 floating-point variables above and display the result to the console.
b) Create a method that will multiply the numbers stored in the 2 integral variables above and display the result to the console.
Expectations
1.Your code should be properly named.
2. Your code should have proper documentation similar to the header below
3. A report on the work done.
Note: Full credit will not be given if expectations are not met.
Sample Header
/********************************************************************
* Given the length and width of a rectangle, this program computes
* and outputs the perimeter and area of the rectangle.
*
* Author: AJ Kim
* Date: August 22, 2017
* Assignment 1: Perimeter and Area of Rectangle
********************************************************************/
Explanation / Answer
/********************************************************************
* Given the length and width of a rectangle, this program computes and outputs
* the perimeter and area of the rectangle.
*
* Author: AJ Kim Date: August 22, 2017 Assignment 1: Perimeter and Area of
* Rectangle
********************************************************************/
public class NumberAndStringsDemo {
/**
* method that will add the numbers stored in the 2 floating-point variables
* above and display the result to the console
*
* @param floatVar1
* @param floatVar2
*/
public static void add(float floatVar1, float floatVar2) {
System.out.printf("Addition of %.2f and %.2f is %.2f ", floatVar1,
floatVar2, (floatVar1 + floatVar2));
}
/**
*
* method that will multiply the numbers stored in the 2 integral variables
* above and display the result to the console.
*
* @param intVar1
* @param intVar2
*/
public static void multiply(int intVar1, int intVar2) {
System.out.println("Multiplication of " + intVar1 + " and " + intVar2
+ " is " + (intVar1 * intVar2));
}
/**
* @param args
*/
public static void main(String[] args) {
// Create and store floating-point numbers.
float floatVar1 = 3.2f, floatVar2 = 3.4f;
// Create and store 2 integral numbers
int intVar1 = 33, intVar2 = 23;
// Create String variables to store your first name and your last name
String lastName = "Kumar";
String firstName = "Rajesh";
System.out.println("Full Name:" + firstName + " " + lastName);
// Create a String variable to store your nationality and print it to
// the console.
String nationality = "Indian";
System.out.println("Nationality:" + nationality);
// calling method add with float parameters
add(floatVar1, floatVar2);
// calling method multiply with int parameters
multiply(intVar1, intVar2);
}
}
OUTPUT:
Full Name:Rajesh Kumar
Nationality:Indian
Addition of 3.20 and 3.40 is 6.60
Multiplication of 33 and 23 is 759