I hope someone can help me with this problem Statement in Java. Please follow th
ID: 3884221 • Letter: I
Question
I hope someone can help me with this problem Statement in Java. Please follow the problem step by step. Thank you
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
/********************************************************************
* Program that demonstrates the use of numbers, strings, and methods.
*
* Author: Sumeet Khirwal
* Date: September 14, 2017
********************************************************************/
import java.io.*;
class Assignment {
// Calculates sum of two floating point numbers and displays it to console
public static void addNumbers(float num1, float num2) {
System.out.println("Sum of " + num1 + " and " + num2 + " is " + (num1 + num2));
}
// Calculates product of two integers and displays it to console
public static void multiplyNumbers(int num1, int num2) {
System.out.println("Product of " + num1 + " and " + num2 + " is " + (num1 * num2));
}
public static void main (String[] args) {
// variables to store any 2 floating-point numbers
float floatingPointNumber1 = 3.6f;
float floatingPointNumber2 = 8.6f;
// variables to store any 2 integers
int integer1 = 3;
int integer2 = 8;
// variables to store your first name and your last name. Calculate, store and print your full name
String firstName = "Sumeet";
String secondName = "Khirwal";
String fullName = firstName + " " + secondName;
System.out.println("My name is : " + fullName);
//variable to store nationality and print it to the console
String nationality = "Indian";
System.out.println("I am " + nationality);
addNumbers(floatingPointNumber1, floatingPointNumber2);
multiplyNumbers(integer1, integer2);
}
}
Sample Output :