Friday, 15 May 2015

Array in Java beginner -


I am beginning to coding in the itemprop = "text">

I write a project that uses the command line argument, from F to C and C to F Degree change till Even those that I have so far received:

  public class implementation {public static zero main (string [] args) {{string [] day = {"very cool" , "Cold", "light", "very light", "hot", "very hot", "hot"}; }} If (args.length! = 3) {System.out.println ("error, please try again."); System.exit (0); } And {double degree; String Celsius; String fahrenheit; Degree = double. PRAD Double (Args [0]); Celsius = Args [1]; Fahrenheit = Args [2]; Switch (Celsius) {case "c": system.out.printf ("% n% s Celsius% s Fahrenheit \ n", args [0], (5.0 / 9.0 * (degree - 32)); break; Case "F": System. OutprintF ("% n% s Fahrenheit% s Celsius \ n", args [0], (9.0 / 5.0 * (degree + 32)); break; }}}}  

We have the degree to degree:

below 0 degree = very cold

0 to 32 = Cold <61> 70 = warm

from 33 to 50 = light

51 to 60 = very light

71 to 90 = Very Hot

Top 90 = Hot

I have a question about array. How do we show the array in the output, depending on the specific degree? Thank you very much!

You define days in your own realm, that is why it is not accessible :

[code] {string {] day = {"very cold", "cold", "light", "very light", "hot", "very hot", "hot"}; }

Just remove curly hair around it.

  string [] day = {"very cold", "cold", "light", "very light", "hot", "very hot", "hot"};  

No comments:

Post a Comment