QuestionQuestion

Part A: You should submit a .java for each part of this assignment. Part A will contain your main method Part A will be a Menu to call and interact with all of your other classes. You will have a class for Part B (you can name it whatever you want) and you will have a class for Part C (probably called newMath but feel free to call it whatever you want).

Part B: Design a class that contains 5 different variables. Your class can be for anything you want but CANNOT be an example given in class (shapes, people). Be creative!
1) Your class should have a default constructor and a constructor that accepts and sets all of the variables in the instance of the object.
2) Your class should have set and get methods for each variable in the object
3) Your class should have AT LEAST ONE void method that interacts with 2 or more of these variables (for example adds their values to set another variable, finds the difference between two variables, prints a string(
4) From the menu in Part A you should be able to create 2 different objects, one using the empty default constructor and set methods to set each variable and the other setting all the values
5) You should then be able to call a menu option to print these objects out using the get methods

Part C: Design a newMath class. This class should consist of three static methods and two non-static methods.
1) The static methods in this class should perform some new mathematical calculations that you invented. For example a method:
static int doubleSum (int a, int b){
return (2*(a+b));
}

This method returns 2 times the the sum of the two numbers it is passed. (do not use this exact method its just used to give you an idea)
2) the two non-static methods in this class should reference a static variable in the class (for example, using it in their calculation or keeping track of how many times a method is called)
3) from the main menu you should have ways to exercise all of these methods, so examples of calling the 3 static methods from a static context, and creating at least 2 different instances of the objects calling the non-static methods just to make sure you are the static variables are getting updated between both instances of the object.


You should submit 3 .java files for this assignment. I suggest zipping up your project into a single zip but feel free to just upload the 3 java files.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class PartA {
    public static void main(String[] args) {
      
       int selection = 1;
       Scanner keyboard = new Scanner(System.in);
       PartB p1 = new PartB();
       PartB p2 = new PartB();
       newMath m = new newMath();
      
       String s, s1;
       double d;
       while (selection != 0) {            
            System.out.print("1. create 2 different partB objects, "
                   + "one using the empty default constructor and set methods to "
                   + "set each variable and the other setting all the values\n"
                   + "2. Print out these object in PartB object \n"
                   + "3. newMath increment method\n"
                   + "4. newMath tenTimeofCounter method\n"
                   + "5. newMath power2 method\n"
                   + "6. newMath haftOf method\n"
                   + "7. newMath tripleOf method\n"
                   + "0. quit\n"
                   + "--->");
            
            selection = keyboard.nextInt();...
$50.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats