Below is an example on 4 primitive data types of them.
Please provide all 8 primitive data types in Java
public class PrimitiveDataTypes {
public static void main(String[] args) {
short age = 43 ;
int numberOfCustomers= 170;
float salary = 12345.23f; // the f is used to denote this is a float datatype. The default is double!
double stateAnnualBudget = 8648645.74;
System.out.println("The float is " + salary + " the double is " + stateAnnualBudget + " the int is" + numberOfCustomers + " the short is " + age);
// now try the other four!
}
}
Simple Program
How would I fix the decimal error program below?
Please illustrtate and suggest another string that will show dblamt in Java
public class SimpleProgram {
public static void main(String[] args) {
double amount = 200.00;
int numberOfEmployees = 3;
System.out.println("Amount divided between the number of employees is: " + amount/numberOfEmployees);
}
}
Mortgage Program
I need help writing a Java program without a graphical user interface that calculates and displays the monthly mortgage payment amount, given the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage.
• In this program, hard code the amount as $400,000, the term as 15 years, and the interest rate as 7.75%. Insert comments in the program to document the program.