Exam 2 - Updated
.docx
keyboard_arrow_up
School
University of Texas, Rio Grande Valley *
*We aren’t endorsed by this school
Course
1380
Subject
Computer Science
Date
Dec 6, 2023
Type
docx
Pages
3
Uploaded by keylym07
CSCI 1380
Yessenia Rodriguez
Name: _______________________
Exam 2
Write a menu-drive program that allows the user to do the following:
a)
Add a student to the class roster.
b)
Find a student in the class roster.
c)
Create a grade report for a given class and score.
The program should use a module that consists of at least the following functions:
def printMenu()
– displays the menu for the program
def addStudent(name, file_roster)
– the name of the student the user wished to add and
the filename for the file with the class roster are given as arguments. If the student’s name
(name) is not found in the class roster, the name should be added to the end of file_roster.
If it is found, the function should display a message informing the user the student was
already in the roster.
def findStudent(name, file_roster)
– the name of the student the user wishes to search
for and the filename for he file with the class roster are given as arguments. If the
student’s name (name) is found in the class roster, the function returns the line number
the name was found in the file file_roster. If it is not found, the function returns -1.
def createReport(file_roster, file_scores, report_name)
– the filenames for the files
with the class roster and students’ grades are given as arguments; additionally, the name
for the report generated is also given. The function generates a grade report that contains
a calculated average (use calcAverage function), the lowest grade, and the highest grade
for the class. If there are more students than grades provided, the list of students pending
the assignment (students with no grade, “extra” students) will be provided in the report. If
there are more grades than students, a warning should be provided in the report to warn
the user the data generated may be incorrect due to the discrepancy.
def calcAverage(file_scores)
– the filename for the file with the students’ grades is given
as an argument. The function calculates and returns the average of all the grades in the
file file_score minus the lowest score (uses the findLowest function).
def findLowest(file_scores)
– the filename for the file with the students’ grades is given
as an argument. The function returns the lowest score in the file file_score.
def findHighest(file_scores)
– the filename for the file with the students’ grades is given
as an argument. The function returns the highest score in the file file_score.
CSCI 1380
Yessenia Rodriguez
Here is an example of the contents of the input file
class_roster.txt
before the program was
executed:
Here is an example of the contents of the input file
scores.txt
:
Here is an example of the contents of the output file, which was called
Exam_1_report.txt
based
on the name entered:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
In order for a player to navigate your game, you will need to develop a function or functions using Python script. Your function or functions should do the following:
Show the player the different commands they can enter (such as “go North”, “go West”, and “get [item Name]”).
Show the player’s status by identifying the room they are currently in, showing a list of their inventory of items, and displaying the item in their current room.
You could make these separate functions or part of a single function, depending on how you prefer to organize your code.
#Sample function showing the goal of the game and move commands def show_instructions(): #print a main menu and the commands print("Dragon Text Adventure Game") print("Collect 6 items to win the game, or be eaten by the dragon.") print("Move commands: go South, go North, go East, go West") print("Add to Inventory: get 'item name'") #In this solution, the player’s status would be shown in a separate function. #You may organize your…
arrow_forward
In order for a player to navigate your game, you will need to develop a function or functions using Python script. Your function or functions should do the following:
Show the player the different commands they can enter (such as “go North”, “go West”, and “get [item Name]”).
Show the player’s status by identifying the room they are currently in, showing a list of their inventory of items, and displaying the item in their current room.
You could make these separate functions or part of a single function, depending on how you prefer to organize your code.
Sample function showing the goal of the game and move commands def show_instructions():
#print a main menu and the commands
print("Dragon Text Adventure Game")
print("Collect 6 items to win the game, or be eaten by the dragon.")
print("Move commands: go South, go North, go East, go West")
print("Add to Inventory: get 'item name'")
The blue image is an example of how the code should look. The map image is the map your code should…
arrow_forward
In order for a player to navigate your game, you will need to develop a function or functions using Python script. Your function or functions should do the following:
Show the player the different commands they can enter (such as “go North”, “go West”, and “get [item Name]”).
Show the player’s status by identifying the room they are currently in, showing a list of their inventory of items, and displaying the item in their current room.
You could make these separate functions or part of a single function, depending on how you prefer to organize your code.
arrow_forward
Using python language, make a program (refer to the image).
arrow_forward
Please provide answer in C#:
Slot Machine Simulation
A slot machine is a gambling device into which the user inserts money and then pulls a lever (or presses a button). The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money that the slot machine dispenses back to the user.
Create an application that simulates a slot machine. Figure 8-23 (on page 539 of your book) shows an example of how the form should look. The application should let the user enter into a TextBox the amount of money he or she is inserting into the machine. When the user clicks the Spin button, the application should display three randomly selected symbols. (Slot machines traditionally display fruit symbols. You will find a set of fruit symbols attached to this dropbox for your use - from the Student Sample Programs provided by the book author.)
If none of the randomly displayed images match, the program should inform the user that he or she has won…
arrow_forward
1.In your game console class, add a start function which should prompt the user for an email address.
-Use a regular expression to validate that it is a valid email address and prompt them again until they enter a valid one.
-Next, prompt the user to enter a credit card number and use a regular expression to validate the credit card.
-Prompt them again until they enter a valid one and once done, display the game menu.
Existing Code below:
class Game {constructor(name){this.name = name;}}
class GameConsole{constructor(){this.games = [];} load(){var gameNames = ["Zelda", "Halo", "Mario", "The God Among Us\n"];for (var i = 0; i < gameNames.length; i++) {let game = new Game(gameNames[i]);this.games.push(game);}} log(){console.log("Games Loaded:");for (var i = 0; i < this.games.length; i++) {var name = this.games[i].name;console.log(name);}}}
let gamecon = new GameConsole();gamecon.load();gamecon.log();
const prompt = require('prompt-sync')();
var adventurersName = ["Captain…
arrow_forward
Monthly Sales
Create a program that allows you to view and edit the sales amounts for each month of the current year.
Console
Monthly Sales program
COMMAND MENU
add - Add sales for specified month
view - View sales for specified month
edit - Edit sales for specified month
totals - View sales summary for year
exit - Exit program
Command: add
Three-letter Month: jan
Sales Amount: 10317
Sales amount for Jan is 10,317.00.
Command: add
Three-letter Month: feb
Sales Amount: 15293
Sales amount for Jan is 15,293.00.
Command: view
Three-letter Month: jan
Sales Amount: 14317
Sales amount for Jan is 14,317.00.
Command: edit
Three-letter Month: jan
Sales amount for Jan is 14,317.00.
Command: totals
Yearly total: 29,610.00
Monthly average: 14,805.00
Command: view
Three-letter Month: july
Invalid three-letter month.
Command: exit
Bye!
Specifications
The program should use a list to store the sales data for each month with the three-letter abbreviation…
arrow_forward
Question 17 mammi .PSEUDOCODE
Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this line
arrow_forward
Please look at image attached.
This is done in Visual Basic, using Microsoft Visual Studio Community Version.
arrow_forward
For the following program:
Monthly Sales
Create a program that allows you to view and edit the sales amounts for each month of the current year.
Console
Monthly Sales program
COMMAND MENU
view - View sales for specified month
edit - Edit sales for specified month
totals - View sales summary for year
exit - Exit program
Command: view
Three-letter Month: jan
Sales amount for Jan is 14,317.00.
Command: edit
Three-letter Month: jan
Sales Amount: 15293
Sales amount for Jan is 15,293.00.
Command: totals
Yearly total: 77,786.71
Monthly average: 6,482.23
Command: view
Three-letter Month: july
Invalid three-letter month.
Command: exit
Bye!
Specifications
The program should use a map to store the sales data for each month with the three-letter abbreviation for the month (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, and Dec) as the key for each item.
When the program starts, it should read the sales data inserted from the user.
If the user edits the…
arrow_forward
Monthly Sales
Create a program that allows you to view and edit the sales amounts for each month of the current year.
Console
Monthly Sales program
COMMAND MENU
view - View sales for specified month
edit - Edit sales for specified month
totals - View sales summary for year
exit - Exit program
Command: view
Three-letter Month: jan
Sales amount for Jan is 14,317.00.
Command: edit
Three-letter Month: jan
Sales Amount: 15293
Sales amount for Jan is 15,293.00.
Command: totals
Yearly total: 77,786.71
Monthly average: 6,482.23
Command: view
Three-letter Month: july
Invalid three-letter month.
Command: exit
Bye!
Specifications
The program should use a map to store the sales data for each month with the three-letter abbreviation for the month (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, and Dec) as the key for each item.
When the program starts, it should read the sales data inserted from the user.
If the user edits the sales data, the program…
arrow_forward
Plus x: A first function
Assign y with 5 plus x.
Ex: If x is 2, then y is 7. If x is 19, then y is 24.
Note: Some challenge activities require completing a function (as above), or writing a new function. You can create test calls to the function in the "Code to call your function" window, then press "Run". Try appending this call to that window: IncreaseValue(9)
When done writing and testing your function, press "Submit for Assessment", which will automatically apply various test calls to your function.
arrow_forward
we can execute a saved function by writing the function name in the :
figure window O
work space
command window O
which is not a function that adds text to
plot
legend O
text O
label O
title O
arrow_forward
1. Code-Tracing
- Without running / testing the following code, predict what the following program would print on the screen if you printed freeze and then boil. Write your answer in the comment section when submitting your work. For help with code-tracing see the code tracing page in
this module.
ments
freeze - int(32)
boil - int(212)
freeze - 0
boil - 100
print(freeze, boil) # what would this print to the monitor?
Research
• Submit your answer in the comment section.
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Related Questions
- In order for a player to navigate your game, you will need to develop a function or functions using Python script. Your function or functions should do the following: Show the player the different commands they can enter (such as “go North”, “go West”, and “get [item Name]”). Show the player’s status by identifying the room they are currently in, showing a list of their inventory of items, and displaying the item in their current room. You could make these separate functions or part of a single function, depending on how you prefer to organize your code. #Sample function showing the goal of the game and move commands def show_instructions(): #print a main menu and the commands print("Dragon Text Adventure Game") print("Collect 6 items to win the game, or be eaten by the dragon.") print("Move commands: go South, go North, go East, go West") print("Add to Inventory: get 'item name'") #In this solution, the player’s status would be shown in a separate function. #You may organize your…arrow_forwardIn order for a player to navigate your game, you will need to develop a function or functions using Python script. Your function or functions should do the following: Show the player the different commands they can enter (such as “go North”, “go West”, and “get [item Name]”). Show the player’s status by identifying the room they are currently in, showing a list of their inventory of items, and displaying the item in their current room. You could make these separate functions or part of a single function, depending on how you prefer to organize your code. Sample function showing the goal of the game and move commands def show_instructions(): #print a main menu and the commands print("Dragon Text Adventure Game") print("Collect 6 items to win the game, or be eaten by the dragon.") print("Move commands: go South, go North, go East, go West") print("Add to Inventory: get 'item name'") The blue image is an example of how the code should look. The map image is the map your code should…arrow_forwardIn order for a player to navigate your game, you will need to develop a function or functions using Python script. Your function or functions should do the following: Show the player the different commands they can enter (such as “go North”, “go West”, and “get [item Name]”). Show the player’s status by identifying the room they are currently in, showing a list of their inventory of items, and displaying the item in their current room. You could make these separate functions or part of a single function, depending on how you prefer to organize your code.arrow_forward
- Using python language, make a program (refer to the image).arrow_forwardPlease provide answer in C#: Slot Machine Simulation A slot machine is a gambling device into which the user inserts money and then pulls a lever (or presses a button). The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money that the slot machine dispenses back to the user. Create an application that simulates a slot machine. Figure 8-23 (on page 539 of your book) shows an example of how the form should look. The application should let the user enter into a TextBox the amount of money he or she is inserting into the machine. When the user clicks the Spin button, the application should display three randomly selected symbols. (Slot machines traditionally display fruit symbols. You will find a set of fruit symbols attached to this dropbox for your use - from the Student Sample Programs provided by the book author.) If none of the randomly displayed images match, the program should inform the user that he or she has won…arrow_forward1.In your game console class, add a start function which should prompt the user for an email address. -Use a regular expression to validate that it is a valid email address and prompt them again until they enter a valid one. -Next, prompt the user to enter a credit card number and use a regular expression to validate the credit card. -Prompt them again until they enter a valid one and once done, display the game menu. Existing Code below: class Game {constructor(name){this.name = name;}} class GameConsole{constructor(){this.games = [];} load(){var gameNames = ["Zelda", "Halo", "Mario", "The God Among Us\n"];for (var i = 0; i < gameNames.length; i++) {let game = new Game(gameNames[i]);this.games.push(game);}} log(){console.log("Games Loaded:");for (var i = 0; i < this.games.length; i++) {var name = this.games[i].name;console.log(name);}}} let gamecon = new GameConsole();gamecon.load();gamecon.log(); const prompt = require('prompt-sync')(); var adventurersName = ["Captain…arrow_forward
- Monthly Sales Create a program that allows you to view and edit the sales amounts for each month of the current year. Console Monthly Sales program COMMAND MENU add - Add sales for specified month view - View sales for specified month edit - Edit sales for specified month totals - View sales summary for year exit - Exit program Command: add Three-letter Month: jan Sales Amount: 10317 Sales amount for Jan is 10,317.00. Command: add Three-letter Month: feb Sales Amount: 15293 Sales amount for Jan is 15,293.00. Command: view Three-letter Month: jan Sales Amount: 14317 Sales amount for Jan is 14,317.00. Command: edit Three-letter Month: jan Sales amount for Jan is 14,317.00. Command: totals Yearly total: 29,610.00 Monthly average: 14,805.00 Command: view Three-letter Month: july Invalid three-letter month. Command: exit Bye! Specifications The program should use a list to store the sales data for each month with the three-letter abbreviation…arrow_forwardQuestion 17 mammi .PSEUDOCODE Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this linearrow_forwardPlease look at image attached. This is done in Visual Basic, using Microsoft Visual Studio Community Version.arrow_forward
- For the following program: Monthly Sales Create a program that allows you to view and edit the sales amounts for each month of the current year. Console Monthly Sales program COMMAND MENU view - View sales for specified month edit - Edit sales for specified month totals - View sales summary for year exit - Exit program Command: view Three-letter Month: jan Sales amount for Jan is 14,317.00. Command: edit Three-letter Month: jan Sales Amount: 15293 Sales amount for Jan is 15,293.00. Command: totals Yearly total: 77,786.71 Monthly average: 6,482.23 Command: view Three-letter Month: july Invalid three-letter month. Command: exit Bye! Specifications The program should use a map to store the sales data for each month with the three-letter abbreviation for the month (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, and Dec) as the key for each item. When the program starts, it should read the sales data inserted from the user. If the user edits the…arrow_forwardMonthly Sales Create a program that allows you to view and edit the sales amounts for each month of the current year. Console Monthly Sales program COMMAND MENU view - View sales for specified month edit - Edit sales for specified month totals - View sales summary for year exit - Exit program Command: view Three-letter Month: jan Sales amount for Jan is 14,317.00. Command: edit Three-letter Month: jan Sales Amount: 15293 Sales amount for Jan is 15,293.00. Command: totals Yearly total: 77,786.71 Monthly average: 6,482.23 Command: view Three-letter Month: july Invalid three-letter month. Command: exit Bye! Specifications The program should use a map to store the sales data for each month with the three-letter abbreviation for the month (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, and Dec) as the key for each item. When the program starts, it should read the sales data inserted from the user. If the user edits the sales data, the program…arrow_forwardPlus x: A first function Assign y with 5 plus x. Ex: If x is 2, then y is 7. If x is 19, then y is 24. Note: Some challenge activities require completing a function (as above), or writing a new function. You can create test calls to the function in the "Code to call your function" window, then press "Run". Try appending this call to that window: IncreaseValue(9) When done writing and testing your function, press "Submit for Assessment", which will automatically apply various test calls to your function.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT