'F' → Fullscreen
Today you write the launch log for a rocket in a new program named 2-1-mission-control. It shows a banner between status messages, counts down, and closes the log — and every one of those jobs ends up as a method of its own.
How to read the code blocks. Each task's code block shows your whole program, from line 1, as it should look when that task is finished.
The green lines marked with a + are the ones you add or change for that task — everything else is already in your file. Do not type the + sign.
PrintBanner();
void PrintBanner(){ Console.WriteLine("========================="); Console.WriteLine(" MISSION CONTROL"); Console.WriteLine("=========================");}FLIGHT CONTROL. Run it, check all three banners changed, and write down how many lines you edited. Then change it back to MISSION CONTROL.PrintBanner();Console.WriteLine("Fuel loaded.");PrintBanner();Console.WriteLine("Crew aboard.");PrintBanner();Console.WriteLine("All systems go.");
void PrintBanner(){ Console.WriteLine("========================="); Console.WriteLine(" MISSION CONTROL"); Console.WriteLine("=========================");}Countdown method below PrintBanner, and the two new lines at the end of the main program. The body of a method can hold any code you know — this one is Activity 1.19's counting-down loop.Countdown, whose header is line 17. Write down the line number it comes back to when Countdown is finished.PrintBanner();Console.WriteLine("Fuel loaded.");PrintBanner();Console.WriteLine("Crew aboard.");PrintBanner();Console.WriteLine("All systems go.");Countdown();Console.WriteLine("The rocket has cleared the tower.");
void PrintBanner(){ Console.WriteLine("========================="); Console.WriteLine(" MISSION CONTROL"); Console.WriteLine("=========================");}
void Countdown(){ for (int i = 3; i >= 1; i--) { Console.WriteLine($"T-minus {i}"); }
Console.WriteLine("LIFTOFF!");}PrintFooter. It prints a line of 25 dashes, then END OF LOG, then the dashes again.END OF LOG is up to you.PrintBanner();Console.WriteLine("Fuel loaded.");PrintBanner();Console.WriteLine("Crew aboard.");PrintBanner();Console.WriteLine("All systems go.");Countdown();Console.WriteLine("The rocket has cleared the tower.");// Call PrintFooter here.
void PrintBanner(){ Console.WriteLine("========================="); Console.WriteLine(" MISSION CONTROL"); Console.WriteLine("=========================");}
void Countdown(){ for (int i = 3; i >= 1; i--) { Console.WriteLine($"T-minus {i}"); }
Console.WriteLine("LIFTOFF!");}
// Write a method named PrintFooter here. It prints three lines:// a line of 25 dashes, then END OF LOG, then the dashes again.Three changes, one at a time. Each one stops the program from building. Write down the error code and the line number the message gives, then put the change back before the next one.
PrintBanner;.P to a small one: printBanner();. Notice that lines 3 and 5 still use the capital.Countdown header, so it reads void Countdown();.For each one, say in your own words what C# was objecting to — the message is written for programmers, and part of the job is translating it.
There is no code block for this task. When it is over, your program is exactly what it was at the end of Task 4.
PrintBanner prints the same line of = signs twice. Write a method named PrintRule that prints that line once, and call it twice from inside PrintBanner.The exam calls a method a procedure, and the reference sheet writes it with the word PROCEDURE.
PrintBanner();
void PrintBanner(){ Console.WriteLine("MISSION CONTROL");}PROCEDURE printBanner(){ DISPLAY("MISSION CONTROL")}
printBanner()The exam has no void. Every procedure starts with the word PROCEDURE, whether or not it hands a value back — the difference shows up inside the body instead, which is Activity 2.3.
printBanner() on the exam, PrintBanner(); in C#: the name, then parentheses. The exam has no semicolons, and its procedure names start with a small letter, the way the reference sheet writes procName. Either way, a call has to match the definition's name letter for letter — Task 5's number 2.
Procedure, method, and function all mean a named group of instructions. The College Board's own course description says the name depends on the language. Read any of the three on the exam as the thing you wrote today.
The finished program's output. Your footer may be centered differently.
========================= MISSION CONTROL=========================Fuel loaded.========================= MISSION CONTROL=========================Crew aboard.========================= MISSION CONTROL=========================All systems go.T-minus 3T-minus 2T-minus 1LIFTOFF!The rocket has cleared the tower.------------------------- END OF LOG-------------------------PrintBanner's body appears once in the file, and the banner prints three timesPrintFooter prints the last three linesAnswer the following questions before submitting your work.
Countdown. Describe where the program went when it reached that line, and where it went when Countdown was finished.Submit four things to the dropbox: