Tuesday 15 September 2015

java - Calling a method adding input -


I'm having trouble finding out how to get output based on user input for my main category. I already have a keyboard entry, where users can enter a value, which will be organized. I'm guessing I'll need to use it, for example (input.input1 ()); . However, I need to include the method which calculates the result, such as calculations.theAverageMassFfTheVehicle from the CalculatingRocketFlightProfile class, I do not know how to combine both to get results.

// Calculation class

  public class CalculatingRocketFlightProfile {// calculation class // declared the total number of public sector declaration; Public double average reward; Public double time assessment charger; Public double mass extract; Public double engine; Public double fuel economy; // Declare the variable to the output massively; double theAverageMassOfTheVehicle; Janata double the Wehlx post-horoscope; Public Calculating RCofProfile Profile (Double Total Impulse, Double Imperial Impulse, Double Time Execution Charger, Double Mass Actiale, Double Engagement, Double Fuel Mess) {// Constructor for this class. IIPUL = Total Impulse; This.averageImpulse = averageImpulse; This.timeEjectionChargeFires = Time EjectionChargeFires; This.massEmptyVehicle = massEmptyVehicle; This.engineMass = engineMass; This.fuelMass = fuelMass; } // Mutators and Accessors // Accessors // Methods for calculation - Calculate output, using inputs. Public Double The Evergence Mass of the World () {Return people Actual Vehicle + ((Engines + + (Engine-Fuel Mass)) / 2); // Formula to calculate the average mass. // Method Public Double ValuesMost () {// Formula / Total / Anticipation / Receipts for calculating the maximum velocity and generation of the wheel (); } // method / / return - get public double contentmovfifewheel () {returnAvulesModoffTheVehicle; } // Method Get Public DoubleWilliamsHistory () {VHXXMXMXXTVT; } // method} // class  

// main category

  public class main {// master class public static zero main (string array [] ) // standard headers for main method {kbentry input = new kbentry (); System.out.print ("\ nPlease enter numbers for total impulse"); System.out.println ("You are logged in:" + input.input1 ()); System.out.print ("\ nPlease enter numbers for average impulse"); System.out.println ("You are logged in:" + input.input2 ()); System.out.print ("Please enter the number for time injection fee:"); System.out.println ("You are logged in:" + input.input3 ()); System.out.print ("Please enter the number for the vehicle's month:"); System.out.println ("You are logged in:" + input.input4 ()); System.out.print ("Please enter a number for the engine's person:"); System.out.println ("You have entered:" + input.input5 ()); System.out.print ("Please enter \ n for the fuel month"); System.out.println ("You are logged in:" + input.input6 ()); // Output calculation RocketFlightProfile calculation = New CalculatingRocketFlightProfile (); System.out.println ("\ nAverage mass of vehicle:" + Calculations. Everest of the Wheelick () + "\ nMaximum speed of vehicles: ++ Calculations .VavilxMost Festival Speed ​​());}}  

// kbentry

  public class kbentry {double input1 () {BufferedReader = new BufferedReader (New InputStreamReader (System.in)); // Total Impulse entry string strTotalImpulse = null ; // This must be mandatory int intialImpulse = 0; //System.out.print("Please enter a number for the total impulse: "); string value from the //system.out.flush (); // keyboard Read {strTotalImpulse = in.readLine ();} Puck {IOException ioe} {// Ignore Exception} // Change it to Integer {intTotalImpulse = Integer.parseInt (strTotalImpulse);} Hold (Number Format Exposition Enough) {System.out.println ("Error! Please enter number!" + Nfe.toString ());}  

The problem is that you have the CalcultingRocketFlightProfile class parameter Required, but you should store those inputs in the variable, then they will convert the variable to the constructor in its new CalCLinkRocketFlipProfile Confidence must that you declared.

/ html>

No comments:

Post a Comment