Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write program with the following: Main Method Sub Method that returns name to Ma

ID: 3660926 • Letter: W

Question

Write program with the following: Main Method Sub Method that returns name to Main Method to Print Sub Method that choses something based on the Age entered by the User. The value is returned to Main Method to Print Sub Method that performs a loop to enter values into an array. Use the loop to enter the values. Do not use data to define the array as stated in class. The Main Method sends "The Trimester is now officially over!" to a Void Sub Method. This same Sub Method request your favorite vacation spot. This same Sub Method prints "The Trimester is now officially over and it is time to go to ??????? !!!!!! ??????? will be replaced by the vacation spot enter by the user

Explanation / Answer

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;


public class Test {

    public static void main(String[] args) throws Exception {
       
        Test test = new Test();
        test.mainMethod(18);
       
    }
   
    //change this logic accordingly and name of the methods
    public void mainMethod(int age) throws IOException {
        String defaultMsg = "The Trimester is now officially over!";
        if(age < 10 ) {
           
        } else if (age > 10 && age < 20) {
           
        } //else etc....
        submethod(defaultMsg);
    }
   
    public void submethod(String msg) throws IOException {
        System.out.println("Please enter your favorite vacation spot");
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String s = br.readLine();
       
        System.out.println(msg+ " and it is time to go to "+s);

         //please remove this, I added this to avoid copiers
         System.out.println("-----------------answered by Ravi------------------");       
    }
//answered by Ravi
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote