Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6944077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:14:21+00:00 2026-05-27T13:14:21+00:00

so my professor has assigned us a project where we have to take in

  • 0

so my professor has assigned us a project where we have to take in commands from a text file and use them to drive the flow of our program. These commands such as- Takeoff, land, load cargo, unload cargo, etc.- are meant to simulate an airplane-like object.

Sometimes these commands don’t make sense to execute, like loading cargo while a plane is in-flight. Therefore, to prevent something like that from happening we had to code in our own exception classes i.e. “If the plane is ordered to load cargo while in flight, throw InvalidActionException”

My question is: how can I continue to read-in commands from the text file after exceptions have been thrown (seeing as how once they are thrown, the program cannot progress further

Here’s an outline of what I want to do:

    Scanner input = new Scanner(new FileInputStream("stuff1.txt"));

    while(input.hasNextLine())
    {
        try 
        {
             //execute commands by reading them using input.nextLine()
        }
        catch()
        {
            //catch any exceptions and ignore them... continue to read
           //the file for more commands
        }
    }

I would appreciate any help. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:14:22+00:00Added an answer on May 27, 2026 at 1:14 pm

    Catch appropriate exception and flow will automatically reach while loop condition.

    After cathing exception nothing extra to be done to continue the program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables Department Professor in which Department has an attribute called HeadID
I have made an application project in Visual Studio 2008 C#, SQL Server from
My professor has asks us to reimplement all of the LinkedList functions from scratch.
Folks, my professor has assigned us an assignment involving typing with arrays, pointers, and
Im trying to make a simple 2D application, and our image processing professor has
I have a project which has a makefile: # a simple makefile # Uncomment,
For a future project we have been assigned to create a simple concept (inside
I have a paired t file of values generated from my program, and the
I have a problem with this question from my professor. Here is the question:
My professor provided me with a file called CursorList.cpp that implements a Cursor Linked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.