+1 (208) 254-6996 [email protected]

A program needs to be made but its a simple intro class of C++. The assignment is attached below.

CISP360 Structured Programming in C++

Don't use plagiarized sources. Get Your Custom Essay on
Its A C++ Introduction
Just from $13/Page
Order Essay

Aircraft Decision Tree (acdt) Professor Caleb Fowler

February 2, 2021

Problem. This assignment implements a hypothetical troubleshooting tree for possible engine failure in light aircraft. DO NOT FOLLOW IN A REAL EMERGENCY! A decision tree is an Artificial Intelligence method for arriving at a decision based upon a collection of IF state- ments. The computer asks a question and responds, based upon the answers. The computer only asks the relevant question based upon the user’s answers (ie you don’t ask all the questions and then try to sort it out.)

Requirements. This program is menu driven. It presents four menu options, repre- senting 3 potential emergency situations: Communications Failure, Engine Failure, In-flight Icing. Quit the program is the final menu option. See figure 1 for an example menu.

1. Communications Failure • This option only leads to 1 element, “Switch to Alternate Radio.”

2. Engine Failure • This activates the decision tree. This is basically a collection

of IF statements arranged in a hierarchy. This is shown on the diagram below.

3. In-Flight Icing • Prompt the pilot for the estimated amount of ice on the wings

(0 mm to 10 mm). Aircraft will not fly with more than 10 mm of ice (and pilots will not be operating this system).

• Range check this to make sure only 0 mm to 10 mm can be entered.

• The amount of ice determines how much power to use to ener- gize the deicing boots on the wings. – Less then 1mm, 5% power – 1 – 5 mm, 20% power – 5.1 – 9 mm, 65% power – 9.1 – 10 mm, 100% power

Menu Options. 1. Communications Failure 2. Engine Failure 3. In-Flight Icing 4. Quit

Figure 1: Allowable menu options for this program.

• Only ask questions relevant to the situation and previous answers. Do not ask for all the inputs at once, nor dump all the output at once (too stressful for the pilot!).

• Display the results of all computations.

Folsom Lake College

Structured Programming in C++

• Make your program output as easy to read as possible. • Program activities are split into logical ’chunks’ or paragraphs. • No global variables or global variable look a-likes. • Use white-space and comments to make your code more readable. • Put a Source File Header at the top of your source file. • Include a void ProgramGreeting() function. This will run auto-

matically once when the program first starts. This function should display (on individual lines): – A welcome message. – Your name (as author). – The date this assignment is due. Format this as MonthName

day, year. Example: June 30, 1988. • Do not your c (.h) style libraries. Use c++ libraries instead. • Your program must compile in C++ on Ubuntu. • Your program must generate logically correct output.


� // Specification C1 – Communications Option This makes the start of the communications option code.

� // Specification C2 – Engine Failure Option This makes the start of the engine failure option code.

� // Specification C3 – In-Flight Icing Option This makes the start of the in-flight icing option code.

Input validation is a big deal. It’s the first line of defense against adversaries. However, we need to balance that against usability. Generally, the more specific the error message you can give the client, the better they will like your program. Usually this means more if tests. You can always add more error tests than specified in the homework.

� // Specification B1 – Menu Input Validation Only allow the client to enter valid numbers for the main menu. Quit the program with invalid entries. You can just display a gen- eral error message for this specification.

� // Specification B2 – Icing Input Validation Only allow a valid range for the de-icing menu. Exit the program with invalid input.

� // Specification B3 – Date On the first line of the main menu, include the current date. You can get the system date and use that, or you can prompt the client for the date. Your choice.

Folsom Lake College

Structured Programming in C++

Figure 2: This is the engine failure menu selection.

Folsom Lake College

Structured Programming in C++

Alphabetic Menu Options. <C>ommunications Failure <E>ngine Failure <I>n-Flight Icing <Q>uit

Figure 3: Allowable menu options for this program in alphabetic format.

� // Specification A1 – Alpha Menu Change from a numeric menu to an alphabetic menu. See figure 3 for an example menu. Keep your numeric menu code – just com- ment it out. I only want 1 menu in operation.

� // Specification A2 – Menu Input Validation Only allow the client to enter valid letters for the main menu. Quit the program with invalid entries. You can just display a general error message for this specification. The replaces specification B1, so also like Specification A1 , just comment out the validation code which doesn’t apply to a numeric menu.

� // Specification A3 – One Function I want to see at least one function in an “A” program. I don’t care what you do with it, just write one. Don’t forget the function prototype.


Element Points Code Compiles 15 Code Runs and generates correct output 10 Source File Header 5 No .h libraries 5 Program Greeting 5 Each of the 3 ’C’ Specifications 5 (15) Bonus for all ’C’ Specifications 5 Each of the 3 ’B’ Specifications 5 (15) Bonus for all ’B’ Specifications 5 Each of the 3 ’A’ Specifications 5 (15) Bonus for all ’A’ Specifications 5 Total Points 100

Late Penalty: -10 points

Due Date.

This assignment is due by 11:59 PM on Sunday on the date on the calendar in Canvas. All the assignments are open the first day of class and you can begin working on them immediately. I encourage you to start sooner rather than later with your homework, these always seem to take longer than you think.

Late Work.

If you miss the due date and time specified above, your work is late. Canvas records the date and time your homework upload COM- PLETES. Late work is still acceptable, but it suffers a 1 letter grade

Folsom Lake College

Structured Programming in C++

penalty. You may turn late work in up until MONDAY 11:59 PM AF- TER THE ASSIGNMENT WAS DUE. That is, you have 1 day to turn your work in – after that the Canvas drop box closes. Once Canvas closes I will not accept an assignment.

Pro-Tip: Get a bare bones copy of your code running and turn it in. Then go ahead and modify it, fix it and whatnot. Upload it with the same name when you finish. That way, if something unexpected happens, you have some working code turned in. Risk management, class, risk management. 1 1 If you really want to go pro, get some

sort of version control system running (like Git).How to Turn in your Homework.

Follow these guidelines for turning in your work:

1. Each assignment has a submit button to turn in your work.

2. Upload your .cpp file, but make sure you change the file extension to .txt. The plagiarism checker doesn’t read .cpp files and I’ve disabled uploading them. I’ll rename your homework to .cpp when I download them.

3. Only submit your homework through Canvas. Do not email them to me or attach them in the comments.

4. Submit a source file I can compile. Do not submit a link to an online editor like repl.it. Do not zip a file. Submit self contained programs – they only have one file to run (no data files, config files, object files, etc.).

5. It is OK to turn in multiple versions of the same file (that you’ve updated. Canvas will automatically download the latest version.

6. It is your responsibility to make sure your file is readable. If your file is ’corrupted’ I will not accept it and you will have failed to turn in that assignment. I expect to be able to see your code in Canvas as well as compile and run it on my computer using Ubuntu.

7. Let me know if you are having any trouble uploading your home- work immediately.

8. I download your files, compile and execute them as well as look over your source code.

Style Guide.

All programs you write MUST have the following code and/or com- ments. Again, I look for these elements with my scripts, you want me to find them.

Folsom Lake College

Structured Programming in C++

Comments. Use white space and comments to make your code more readable.

I run a program called cloc (count lines of code) which actually looks for this stuff.

End of line comments are only permitted with variable declara- tions. Full line comments are used everywhere else.

Specification Comments. Specifications are bundled into groups: “A”, “B”, “C”. You must

meet the specifications of the lowest group before I will count the specifications for the highest group. For example, you must meet the “B” specifications before I will count the “A” specifications. If you miss one element of a specification bundle, that is the grade you will get for the assignment – regardless of how much extra work you do.

Use whole line comments for Specifications. Put the comment on the line above the start of the code implementing the Specification. If the same Specification code appears in more than 1 place, only com- ment the first place that Specification code appears. Number your Specifications according to the specification bundle and the specific specification you are using, also provide a very short description. DO NOT BUNCH ALL YOUR SPECIFICATIONS AT THE TOP OF THE SOURCE FILE. Example specification comment:

// Specification A2 – Display variables

Your code to do this starts here;

It’s very important to get the specifications down correctly. If your specification code isn’t commented, it doesn’t count. I use the grep trick to find your specification code. Proper documentation is part of the solution, just like actually coding the solution is.

Compiler Warnings. Compiler warnings are a potential problem. They are not tolerated

in the production environment. In CISP 360 you can have them. I will deduct a small number of points. CISP 400 – I will deduct lots of points if compiler warnings appear. Make sure you compile with -Wall option. This is how you spot them.

C++ Libraries. We are coding in C++, not C. Therefore, you must use the C++

libraries. The only time you can use the C libraries is if they haven’t been ported to C++ (very, very rare).

Non-Standard Language Extensions. Some compilers support unapproved extensions to the C++ syn-

tax. These extensions are unacceptable. Unsupported extensions are compiler specific and non-portable. Do not use them in your pro- grams.

Folsom Lake College

Structured Programming in C++

Program Greeting. Display a program greeting as soon as the program runs. This is a

simple description of what the program does. Example:

// Program Greeting

cout « “Simple program description text here.” « endl;

Source File Header. Start your source file with a program header. This includes the

program name, your name, date and this class. I use the grep trick for .cpp (see below) to look for this. I focus on that homework name and display the next 3 lines. Example:

// drake.cpp

// Pat Jones, CISP 413

// 12/34/56

Specifications and Specification Bundles. You document specifications like this: // Specification C1 – Some


You do not need to code them in order. You will probably want to because the specifications get harder as you move up in bundles (not THAT much harder). You also don’t need to worry about the specification comments appearing in order in your code, either.

However, all of a specification bundle must be coded to reach that bundle grade (ie all C bundle to get a C). Partially completed bundles DO NOT COUNT. Say you code all specifications for a B bundle and only 1 for an A bundle (out of 5 for example). The highest grade you would get would be a B because that’s the last bundle you’ve completed.

You can stop at any bundle you want, you just can’t get a higher grade (ex, you code all specifications for bundle B – the best you can get for this homework is a B). This is designed to mirror the work word, the more features your code has, usually, the happier your clients are. This also gives you some control over your grade.

This style guide has more information on the specifics of these comments.

Variables. Constant variables – anytime you have a value which is not sup-

posed to change, that’s a constant. We make it read only with the const keyword and signify it with the ALL CAPS style: const PI = 3.14; We prefer using constants because they make the code easier to read. There are a few situations where we do not usually use them, such as starting a loop at zero. However, if we have that loop end at,

Folsom Lake College

Structured Programming in C++

say, 33, then it’s a magic number. What’s 33? Who knows? If we use const SIZE = 33; we know what 33 is.

When we have numeric literals appearing in the program we call these magic numbers. We don;t know what they are, but if we change them, the program breaks. hence, magic. Magic numbers are gener- ally frowned upon.

Grep Trick.

Always run your code immediately before your turn it in. I can’t tell you how many times students make ’one small change’ and turn in broken code. It kills me whenever I see this. Don’t kill me.

You can check to see if I will find your specification and feature comments by executing the following command from the command line. If you see your comments on the terminal, then I will see them. If not, I will NOT see them and you will NOT get credit for them. The following will check to see if you have commented your specifi- cations:

grep -i ’specification’ homework.cpp

This will generate the following output. Notice the specifications are numbered to match the specification number in the assignment. This is what I would expect to see for a ’C’ Drake assignment. Note the cd Desktop changes the file location to the desktop – which is where the source file is located.

This is what I would expect to see for an ’A’ level Drake assign- ment.

We can also look at the line(s) after the grep statement. I do this to pay attention to code segments.

grep -i -C 1 ’specification’ aDrake.cpp

Folsom Lake College

Structured Programming in C++

We can also use this to look for other sections of your code. The grep command searches for anything withing the single quotes ”, and the -i option makes it case insensitive. This is how I will look for your program greeting:

The grep trick is extremely powerful. Use it often, especially right before you turn in your code. This is the best way I can think of for you to be sure you met all the requirements of the assignment.

Client System.

Your code must compile and run on the client’s system. That will be Ubuntu Desktop Linux, version 18.04. Remember, sourcefile.cpp is YOUR program’s name. I will type the following command to compile your code:

g++ -std=c++14 -g -Wall sourcefile.cpp

If you do not follow this standard it is likely I will detect errors you miss – and grade accordingly. If you choose to develop on an- other system there is a high likelihood your program will fail to compile. You have been warned.

Using the Work of Others.

This is an individual assignment, you may use the Internet and your text to research it, but I expect you to work alone. You may discuss code and the assignment. Copying code from someone else and turning it in as your own is plagiarism. I also consider isomorphic homework to be plagiarism. You are ultimately responsible for your

Folsom Lake College

Structured Programming in C++

homework, regardless of who may have helped you on it. ProTip: Get a bare bones copy of your code running and turn it in. Then go ahead and modify it with bonuses and whatnot. Upload it with the same name so it replaces your previous homework. This way, if something comes up or you can’t finish your homework for some reason, you still have something turned in. A “C” is better than a zero. Risk management class, risk management.

Canvas has a built in plagiarism detector. You should strive to generate a green color box. If you submit it and the score is too high, delete it, change your code and resubmit. You are still subject to the due date, however. This does not apply if I have already graded your homework.

Often, you will not be able to change the code to lower the score. In this case, include as a comment with your homework, what you did and why you thought it was ineffective in lowering your score. This shows me something very important – you are paying attention to what you are doing and you are mindful of your plagiarism score.

Folsom Lake College

  • Problem.
  • Requirements.
  • Due Date.
  • Late Work.
  • How to Turn in your Homework.
  • Style Guide.
  • Grep Trick.
  • Client System.
  • Using the Work of Others.
  • List of Figures.
  • Educational Objectives.
  • Change log.

Order your essay today and save 10% with the discount code ESSAYHELP