'F' → Fullscreen
Create a new C# program named 1-6-arithmetic, starting empty.
Use the same subject you chose for Activity 1.5 — the athlete, character, or officer whose card you built. Today they get a score that moves.
The examples below continue with the RPG character from Activity 1.5. If you built a different kind of card, swap in your own subject and events — the arithmetic works the same either way.
This activity runs over two sessions. Tasks 1 to 4 are the first; Tasks 5 and 6 are the second.
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.
You never start a new file and you never delete your work. 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.
string for the name and an int score starting at 0.int again.Two lines of output, two different numbers, one variable. That is the whole idea.
string characterName = "Sephiroth";int score = 0;
Console.Write(characterName);Console.WriteLine(" enters the dungeon.");Console.Write("Score: ");Console.WriteLine(score);
score = 3;Console.Write("Score: ");Console.WriteLine(score);string characterName = "Sephiroth";int score = 0;
Console.Write(characterName);Console.WriteLine(" enters the dungeon.");Console.Write("Score: ");Console.WriteLine(score);
score = 3;Console.Write("Score: ");Console.WriteLine(score);
score = score + 2;Console.Write("Score: ");Console.WriteLine(score);
score = score + 2;Console.Write("Score: ");Console.WriteLine(score);Console.WriteLine() to separate the two halves of the output.string characterName = "Sephiroth";int score = 0;
Console.Write(characterName);Console.WriteLine(" enters the dungeon.");Console.Write("Score: ");Console.WriteLine(score);
score = 3;Console.Write("Score: ");Console.WriteLine(score);
score = score + 2;Console.Write("Score: ");Console.WriteLine(score);
score = score + 2;Console.Write("Score: ");Console.WriteLine(score);
Console.WriteLine();
int adventurers = 47;int perParty = 6;int fullParties = adventurers / perParty;int leftOver = adventurers % perParty;
Console.Write("Adventurers:");Console.WriteLine(adventurers);Console.Write("Parties: ");Console.WriteLine(fullParties);Console.Write("Left over: ");Console.WriteLine(leftOver);Whole-number division did the hard part for you. 47 / 6 is 7 on its own — there is nothing to round down, because the fraction was never kept.
Five experiments. Write down exactly what appears each time, copied from the screen rather than from memory. Undo each one before the next.
8 / 3.double average = 47 / 6; and print average.47.0 / 6.10 % 3 * 2, then print 10 % (3 * 2).score + 2; on a line by itself, with nothing to the left of it.One of these refuses to run. The other four produce a number, and at least two of them will not be the number you expected. Which is which is what the sheet asks for.
There is no code block for this task. Each experiment is temporary and gets undone before the next one, so when Task 4 is over your program is exactly what it was at the end of Task 3.
Console.Write and Console.WriteLine pair with a single interpolated line.Console.Write and Console.WriteLine pair you already had.string characterName = "Sephiroth";int score = 0;
Console.WriteLine($"{characterName} enters the dungeon at {score}.");
score = 3;Console.WriteLine($"First kill. Score is {score}.");
score = score + 2;Console.WriteLine($"Side quest. Score is {score}.");
score = score + 2;Console.WriteLine($"Another kill. Score is {score}.");
Console.WriteLine();
int adventurers = 47;int perParty = 6;int fullParties = adventurers / perParty;int leftOver = adventurers % perParty;
Console.WriteLine($"{adventurers} adventurers, {perParty} to a party.");Console.WriteLine($"Parties: {fullParties}");Console.WriteLine($"Left over: {leftOver}");Console.WriteLine().adventurers to 100 and run it again. Every number should move. Set it back to 47.string characterName = "Sephiroth";int score = 0;
Console.WriteLine($"{characterName} enters the dungeon at {score}.");
score = 3;Console.WriteLine($"First kill. Score is {score}.");
score = score + 2;Console.WriteLine($"Side quest. Score is {score}.");
score = score + 2;Console.WriteLine($"Another kill. Score is {score}.");
Console.WriteLine();
int adventurers = 47;int perParty = 6;int fullParties = adventurers / perParty;int leftOver = adventurers % perParty;
Console.WriteLine($"{adventurers} adventurers, {perParty} to a party.");Console.WriteLine($"Parties: {fullParties}");Console.WriteLine($"Left over: {leftOver}");
Console.WriteLine();
int partyFee = 25;int soloFee = 7;
Console.WriteLine($"Party entries: {fullParties * partyFee}");Console.WriteLine($"Solo entries: {leftOver * soloFee}");Console.WriteLine($"Total: {fullParties * partyFee + leftOver * soloFee}");10 - 2 * 3 (10 - 2) * 3 7 / 2 7 % 2int total = 17 + 5;int extra = 17 % 5;score = score + 2;total ← 17 + 5extra ← 17 MOD 5score ← score + 2+, -, *, and / are written the same way in both.MOD instead of %. Same operation, same priority.score ← score + 2 is the same instruction as score = score + 2;, read the same way: right side first.17 / 5 is 3.4. In C# it is 3. Trust the sheet on the exam and C# in your programs — and remember that the sheet never has to worry about types, because it has none.The sheet also lists one thing you have no C# match for yet:
roll ← RANDOM(1, 6)RANDOM(a, b) gives a whole number from a to b, and both ends are included — so RANDOM(1, 6) can give a 1 or a 6. Getting randomness in C# takes a little more, and Activity 1.16 does it.
Your finished program should produce this.
Sephiroth enters the dungeon at 0.First kill. Score is 3.Side quest. Score is 5.Another kill. Score is 7.
47 adventurers, 6 to a party.Parties: 7Left over: 5
Party entries: 175Solo entries: 35Total: 210Console.Write and Console.WriteLine pair is left.adventurers to 100 moves every number below it.Answer the following questions before submitting your work.
score = score + 2; would be false as a math equation. Describe, in order, what C# actually does with that line.47 / 6 gave 7 and 47.0 / 6 gave 7.833333333333333. Only one character changed. Explain why that changed the answer.17 / 5 is 3.4. C# says it is 3. Both are correct. How would you explain that to someone who thinks one of them must be wrong?Submit four things to the dropbox: