• Define in a Class the following data types
  • Demonstrate use of Primitives: int, double, boolean, string
  • Demonstrate use of Wrapper Class object: String
  • Describe in comments how each data type choice is appropriate to application
  • Perform arithmetic expressions and assignment in a program code Code.org Lesson
  • Determine what is result is in a variable as a result of an data type and expression (ie integer vs double)
  • Perform an arithmetic expressions that uses casting, add comments that show how it produces desired result. Learn more by watching this College Board video
  • Perform compound assignment operator (ie +=), add comments to describe the result of operator

Code below, Collaborated with Don Tran

import java.util.Scanner;

public class Kitkatwrapper{
    public static void main(String[] args) {
        Scanner myObj = new Scanner(System.in);  // Create a Scanner object

        System.out.println("Enter a salary between 0-1,000,000"); // Number 1, gets salary
        double salary = myObj.nextDouble();  // Read user input
        System.out.println(salary);
        double oldSalary = salary; // records oldsalary for percent calculation later

        System.out.println("Enter your pay raise"); // Number 2, gets raise to salary
        double raise = myObj.nextDouble();  // Read user input
        System.out.println(raise);

        salary += raise; // the inputted number of "raise" is added onto the original inputted "salary"

        int percent = (int) (100*(salary / oldSalary)-100); // calculates percent raise

        myObj.close(); // closing object, stops reading text inputs

        boolean payraisequality; // defines boolean variable
        String message; // defines message

        if(percent > 5){
            payraisequality = true;
        }
        else{
            payraisequality = false;
        }

        if (payraisequality == true){
            message = "You got a good pay raise!";
        }
        else{
            message = "You got a bad pay raise.";
        }

        System.out.println("Your final salary is: " + salary + ", which is around a " + percent + "% raise from your original salary. " + message);  // Output user input
    }
}

Kitkatwrapper.main(null);
Enter a salary between 0-1,000,000
123123.0
Enter your pay raise
123123.0
Your final salary is: 246246.0, which is around a 100% raise from your original salary. You got a good pay raise!