'F' → Fullscreen
Create a new C# program named 1-6-gameday, 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.
This activity runs over two sessions. Tasks 1 to 4 are the first; Tasks 5 and 6 are the second.
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 playerName = "Maya Okonkwo";int score = 0;
Console.Write(playerName);Console.WriteLine(" tips off.");Console.Write("Score: ");Console.WriteLine(score);
score = 3;Console.Write("Score: ");Console.WriteLine(score);Maya Okonkwo tips off.Score: 0Score: 3string playerName = "Maya Okonkwo";int score = 0;
Console.Write(playerName);Console.WriteLine(" tips off.");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);Maya Okonkwo tips off.Score: 0Score: 3Score: 5Score: 7Console.WriteLine();
int players = 47;int perTeam = 6;int fullTeams = players / perTeam;int leftOver = players % perTeam;
Console.Write("Players: ");Console.WriteLine(players);Console.Write("Full teams: ");Console.WriteLine(fullTeams);Console.Write("Left over: ");Console.WriteLine(leftOver);Players: 47Full teams: 7Left over: 5Whole-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.
Console.Write and Console.WriteLine pair with a single interpolated line.string playerName = "Maya Okonkwo";int score = 0;
Console.WriteLine($"{playerName} tips off at {score}.");
score = 3;Console.WriteLine($"Three-pointer. Score is {score}.");
score = score + 2;Console.WriteLine($"Layup. Score is {score}.");
score = score + 2;Console.WriteLine($"Another two. Score is {score}.");
Console.WriteLine();
int players = 47;int perTeam = 6;int fullTeams = players / perTeam;int leftOver = players % perTeam;
Console.WriteLine($"{players} players, {perTeam} to a team.");Console.WriteLine($"Full teams: {fullTeams}");Console.WriteLine($"Left over: {leftOver}");Maya Okonkwo tips off at 0.Three-pointer. Score is 3.Layup. Score is 5.Another two. Score is 7.
47 players, 6 to a team.Full teams: 7Left over: 5players to 100 and run it again. Every number should move. Set it back to 47.Console.WriteLine();
int teamFee = 25;int soloFee = 7;
Console.WriteLine($"Team entries: {fullTeams * teamFee}");Console.WriteLine($"Solo entries: {leftOver * soloFee}");Console.WriteLine($"Total: {fullTeams * teamFee + 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.
Maya Okonkwo tips off at 0.Three-pointer. Score is 3.Layup. Score is 5.Another two. Score is 7.
47 players, 6 to a team.Full teams: 7Left over: 5
Team entries: 175Solo entries: 35Total: 210Console.Write and Console.WriteLine pair is left.players 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: