The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 6 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
I need this code fixed my assignment is attached to this post. Eclipse is giving me a few errors and I can't fix them. My deadline is tomorrow at 9pm
Â
/***************************************************************************************
* HAUnit4.java
* Alicia Holmes
*
* This program determines whrn you should head to the airport for an upcoming flight.
*****************************************************************************************/
Â
import java.util.Scanner;
Â
public class HAUnit4
{
 public static void main (String[] args)
 {
  Scanner stdIn = new Scanner(System.in) ;
  String flightDay;      // user entered-day of flight departure
  String currentDay;      // current day
  int flightHour;       // military hour of flight departure
  int currentHour;       // current military hour
  char response;        // user's response y/n response
  boolean departureDay = true; // Does the current day match the flight day?
  int HOURS_LEFT_TILL_FLIGHT; // hours left until flight departure
  HOURS_LEFT_TILL_FLIGHT = currentHour - flightHour;
Â
  do
  {
   System.out.print ("Enter the day of your flight: ");
   flightDay = stdIn.nextString ();
   System.out.print ("Enter the hour your flight leaves: ");
   flightHour = stdIn.nextInt ();
   System.out.print ("Enter the current day: ");
   currentDay = stdIn.nextString ();
   System.out.print ("Enter the current hour: ");
   System.out.print ("Is today your departure day? (y/n): ");
   response = stdIn.next() .charAt (0);
   while (!response.equals (n) && !response.equalsIgnoreCase (N))
   {
    System.out.println ("Invalid entry.") ;
    System.out.println (Today isn't your flight, keep checking.") ;
   } while (response == 'n' || response == 'N') ;
   }Â
Â
  if (departureDay))
  {
Â
   switch (int HOURS_LEFT_TILL_FLIGHT)
   {
    case 17: case 18: case 19: case 20: case 21: case 22: case 23:
     System.out.println("Are you seriously checking this early?") ;
     break;
    case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 16:
     System.out.println("Plenty of time, no need to rush.") ;
     break;
    case 3: case 4:
     System.out.println("Better be heading to the airport.") ;
     break;
    case 2:
     System.out.println("Hope you are at the airport.") ;
     break;
    case 1:
     System.out.println("You best be at the airport, security lines are long.") ;
     break;
    default:
     System.out.println("Hopefully you made your flight.") ;
   } // end switch
  }
     System.out.println("Thanks for planning your trip with us.") ;
 } // end main
} // end class HAUnit4
Attachments:
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly