Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Need help getting the output of this code to be, by adding another Interface class : Pumping down chamber... Chamber pumped down and @

JAVA Need help getting the output of this code to be, by adding another Interface class :

Pumping down chamber... Chamber pumped down and @ 0 torr. HiVac turbo spinning up... HiVac turbo @ speed. Gate valves opening... All gate valves open. Heater power on... Heater starting... Heater at operating temperature. System ready for production.

This is the current code:

package interfaceSample;

import java.util.ArrayList; import java.util.Scanner; //Imports //Begin Class Interface public class Interface {

//Begin Main Method public static void main(String[] args) {

/* Variable */ String ans;

/* New scanner object */ Scanner yn = new Scanner(System.in);

/* Create new instance of subclass */ ShutDown object = new ShutDownSystem();

System.out.print("Shutdown HiVac chamber? Y or N ->: "); ans = yn.nextLine(); if (ans.equalsIgnoreCase("n")) { System.out.println("Shut down process canceled."); } else if (ans.equalsIgnoreCase("y")) { object.shutDown(); /* Call shutdown method */ } else { System.out.println("You must enter either Y or N"); } } //End Main Method } //End Class Interface

package interfaceSample; //Imports //Begin Subclass ShutDownSystem public class ShutDownSystem implements ShutDown, Suspend {

/** * Implementation of the Shutdown interface */ @Override public void shutDown() { /* Calls to methods */ shutDown_Heater(); shutdown_GateValves(); shutdown_Turbo(); shutDown_Evacuate(); suspend(); }

/** * Implementation of the Suspend interface */ @Override public void suspend() { /* Call to method */ suspend_Production(); }

/** * Heater shutdown method used to turn off heaters */ private void shutDown_Heater() { System.out.println("Heater shutting down..."); /* Code that runs a heater shutdown process call here */ System.out.println("Heater power off..."); System.out.println("Heater at ambient temperature."); }

/** * Gate valve shutdown method to close gate valves */ private void shutdown_GateValves() { System.out.println("Gate valves closing..."); /* Code that closes gate valves call here */ System.out.println("All gate valves closed."); }

/** * Turbo shutdown method to shutdown HiVac turbo */ private void shutdown_Turbo() { System.out.println("HiVac turbo spinning down..."); /* Code that runs turbo shutdown process call here */ System.out.println("HiVac turbo spun down Currently @ 0.0 rpm."); }

/** * Evacuate method to bring chamber to atmosphere */ private void shutDown_Evacuate() { System.out.println("Pressure release valve on HiVac chamber opening..."); /* Code that runs pressure release process call here */ System.out.println("Pressure @ 1 atmosphere (760 torr) Safe to open chamber."); }

/** * Suspend method used to suspend production line */ private void suspend_Production() { /* Code that calls suspend production line process call here */ System.out.println("The production line has been suspended."); }

} //End Subclass ShutDownSystem

package interfaceSample;

public interface ShutDown { public void shutDown(); } package interfaceSample;

interface Suspend { public void suspend(); }

This is the current Output

Shutdown HiVac chamber? Y or N ->: y Heater shutting down... Heater power off... Heater at ambient temperature. Gate valves closing... All gate valves closed. HiVac turbo spinning down... HiVac turbo spun down Currently @ 0.0 rpm. Pressure release valve on HiVac chamber opening... Pressure @ 1 atmosphere (760 torr) Safe to open chamber. The production line has been suspended.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions