Algorith for Final Lab Exam
.docx
keyboard_arrow_up
School
American Military University *
*We aren’t endorsed by this school
Course
240
Subject
Computer Science
Date
Jan 9, 2024
Type
docx
Pages
1
Uploaded by student1673
Algorith for Final Lab Exam
1.
Declare struct
2.
Declare function prototypes
3.
Declare struct variable
4.
Declare array
5.
Declare variables
6.
Declare input stream variable
7.
Open input stream file
8.
Print name and titles to the screen
9.
Read the first line of name and the corresponding points from the input file and calculate the total
10.
Read the second line of name and the corresponding points from the input file and calculate the
total. Set the worstApp name and worstSum
11.
Use a while loop to read data from the input file
a.
Read name from the input file
b.
Assign the read input file to the array
c.
Read each points from input file
d.
Calculate the total of all points using the formula
e.
Display the read input to the screen
f.
If the total is greater than the value of sum, then assign the value of this total to the variable bestSum and the corresponding name to the string variable bestApp
g.
Update loop control variable
h.
If the loop control variable is equal to 5, break from the while loop
i.
Call the printBestApp function to output the bestApp and the total points received
j.
Call the printWorstApp function to output the worstApp and the total points received
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
PYTHON without def function
Problem Statement
Suppose an input file (called "paragraph.txt") contains a paragraph of text. Read in the file and then count/print the number of times the word "book" is in the file.
Hint: Punctuation should be ignored, i.e., "book?" and "book!" should increase the count. The program should also be case-insensitive.
Sample Input (File paragraph.txt)
I have a book. It's called Harry Potter. It's a pretty good book! Do you want to buy my BOOK?
Sample Output
The word 'book' appears 3 time(s).
arrow_forward
Problem Definition
You are provided with a text file (employees.txt) containing a number of text lines. Each line contains a record of one
employee. Each record has three attributes:
Title: string, Prof. (Professor) or Dr. (Doctor).
First and Last names: string.
Salary: float number.
The attributes are separated by the character (',). Figure 1.a, 1.b, and 1.c show a sample of employees.txt files.
Dr., Julia Scott, 141518
Dr., Julia Scott, 141518
Prof.,Joan Stewart, 111673
Mr.,Ali Al-shukaili,122311
Prof., Sana Al-Abri, 131673
Prof.,Joan Stewart
Dr., Fadi A1-Rasdhi, 153790
Ms., Salwa Al-Youssfi, 111675
Dr., Daniel Cooper, 153790
Dr., Lillian Brown, unknown
Dr. :Benjamin Russell:117642
Dr., Daniel Cooper, 153790
Dr., Lillian Brown, 67251
Dr., Benjamin Russell,117642
Prof., Patrick Bailey, 72305
Dr., Ralph Flores, 118457
Dr., Douglas Flores, 181793
Dr., Lillian Brown, 67251
Figure 1.b: A sample of the text file 'employees.txt"
Figure 1.a: A sample of the text file
'employees.txt' without…
arrow_forward
The read position advances towards the end of the file when items from the file are read.
the report True or False:
arrow_forward
Python - Next Birthdate
In this task, we will write a program that reads birthdate data from a given CSV file, and given the current date, determines which person's birthday will be celebrated next.
Create a function with the following signature:
nextBirthdate(filename, date)
filename: parameter, which represents the CSV filename.
date: parameter, which represents the current date.
The function should open the CSV file, read the birthdate data, and determine which person's birthday will be celebrated next, given the current date. The name of the person should be returned. In other words, given a date, find the person whose birthday is next.
Sample Run
birthdates.csv
Draven Brock, 01/21/1952
Easton Mclean, 09/02/1954
Destiny Pacheco, 10/10/1958
Ariella Wood, 12/20/1961
Keely Sanders, 08/03/1985
Bryan Sloan,04/06/1986
Shannon Brewer, 05/11/1986
Julianne Farrell,01/29/2000
Makhi Weeks, 03/20/2000
Lucian Fields, 08/02/2018
Function Call
nextBirthdate("birthdates.csv", "01/01/2022")
Output…
arrow_forward
The seekg function parameter does not include A. positionB. offsetC. dirD. file pointer
arrow_forward
Constraints:
Use Python
Don't use global variables
Don't use external libraries (PIL and os are allowed)
Start the program with a main function (def main():)
Content:
Ask the user for an input (an image file). If the file uploaded is not a jpeg/jpg file, print out "Try again!" and ask for an input once more. Continuously ask until a jpeg/jpg file is uploaded.
Once a jpeg file is uploaded, create a function with the argument img_info and return a tuple with the image's dimensions in pixels (w, h) and the image data in a form of a list of tuples with RGB values.
Print out the values/data collected.
Thank you!
arrow_forward
Phresh Ladies Makeup Line and We are Ladies Co. are merging their businesses and want to merge their product files. Each file contains a product number, name, quantity, and price, and each file is arranged by product number accordingly. Design the logic for a program using pseudocode that merges the two files into one file containing all products. Assume that all product numbers are unique.
arrow_forward
Python Program Language
Write a program that takes in a sentence a user inputs, turns in into title case and appends it to a file on a new line called title.txt. At the end of the sentence add the word count.
arrow_forward
home / study / engineering ! somputer science / computer science questions and answers / g/write a m-file matlab program call it eg2mfile withou
Question: Q/Write a m-file matlab program call it Eq2.mfile without using...
Q/Write a m-file matlab
program call it Eq2.mfile
without using sum
command find the
summation of any
matrix(a)?
arrow_forward
True or FalseAs items are read from the file, the read position moves forward, toward the end of the file.
arrow_forward
Type in C
Make sure the student ID shows for each line please.
arrow_forward
SEARCH CANDIDATE BY QUALIFICATION
Search an Election Candidate
Write a program to display the election
candidate details from the file to the console.
Read the qualification detail from the console
and search the candidates corresponding to
the qualification from the file and display the
details.
Format of the file.txt file
Rajkumar,32,BSc,Chennai
Chandrabose,30,BEd,Chennai
Tamil Selvan,27,BSc,Chennai
Ramkumar, 26,BE,Chennai
Selvan,27,BEd,Chennai
Pratap Raj,34,BSc,Chennai
Input Format:
First line of the input consists of qualification.
Output Format:
Display the Election Candidate Details
arrow_forward
FILE HANDLING
please attach sourcecode/ c language program
arrow_forward
PYTHON without Def function
Problem Statement
Given a grades.txt file of grades on an exam, output a final_grades.txt file in which each score is curved such that the person with the highest score has a score of 100. If someone gets over 100 on the exam, curve all of the grades downward so that the highest score is a 100.
Sample Input 1 (File grades.txt)
FirstName LastName Grade Harry Potter 86 Ronald Weasley 85 Hermione Granger 98
Sample Output 1 (File final_grades.txt)
FirstName LastName Grade Harry Potter 88 Ronald Weasley 87 Hermione Granger 100
Sample Input 2 (File grades.txt)
FirstName LastName Grade Harry Potter 86 Ronald Weasley 85 Hermione Granger 110
Sample Output 2 (File final_grades.txt)
FirstName LastName Grade Harry Potter 76 Ronald Weasley 75 Hermione Granger 100
arrow_forward
Q1\Write a program that sums the numbers between 1 and 9 and finds the sum total
1. Add file
Q2\Write a program using MATLAB to enter the grades of the first semester with an assessment for
each grade and does the grade represent a pass or a failure
1. Add file
arrow_forward
C program
arrow_forward
Python coding exercise: please include comments to further my understanding
Goal #1: import financial data given into your program provided to you as a CSV formatted text file
Use the following data for testing (the following is only a sample of the data; there are over 4000 rows of data):*Note: The data you will read in is linear by date (but, non-contiguous due to holidays and weekends,) reflecting a timeline of stock performance in chronological order; however your program should run through the days in the data from the earliest date to the most recent
Date
Open
High
Low
Close
Adj Close
Volume
1/3/2000
3.745536
4.017857
3.631696
3.997768
2.69592
1.34E+08
1/4/2000
3.866071
3.950893
3.613839
3.660714
2.468626
1.28E+08
1/5/2000
3.705357
3.948661
3.678571
3.714286
2.504751
1.95E+08
1/6/2000
3.790179
3.821429
3.392857
3.392857
2.287994
1.92E+08
1/7/2000
3.446429
3.607143
3.410714
3.553571
2.396373
1.15E+08
Write the code in the clearest and most efficient way possible…
arrow_forward
Question in attached image
arrow_forward
2. Flowchart needed
3. Psuedocode needed for a,b,c
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Related Questions
- PYTHON without def function Problem Statement Suppose an input file (called "paragraph.txt") contains a paragraph of text. Read in the file and then count/print the number of times the word "book" is in the file. Hint: Punctuation should be ignored, i.e., "book?" and "book!" should increase the count. The program should also be case-insensitive. Sample Input (File paragraph.txt) I have a book. It's called Harry Potter. It's a pretty good book! Do you want to buy my BOOK? Sample Output The word 'book' appears 3 time(s).arrow_forwardProblem Definition You are provided with a text file (employees.txt) containing a number of text lines. Each line contains a record of one employee. Each record has three attributes: Title: string, Prof. (Professor) or Dr. (Doctor). First and Last names: string. Salary: float number. The attributes are separated by the character (',). Figure 1.a, 1.b, and 1.c show a sample of employees.txt files. Dr., Julia Scott, 141518 Dr., Julia Scott, 141518 Prof.,Joan Stewart, 111673 Mr.,Ali Al-shukaili,122311 Prof., Sana Al-Abri, 131673 Prof.,Joan Stewart Dr., Fadi A1-Rasdhi, 153790 Ms., Salwa Al-Youssfi, 111675 Dr., Daniel Cooper, 153790 Dr., Lillian Brown, unknown Dr. :Benjamin Russell:117642 Dr., Daniel Cooper, 153790 Dr., Lillian Brown, 67251 Dr., Benjamin Russell,117642 Prof., Patrick Bailey, 72305 Dr., Ralph Flores, 118457 Dr., Douglas Flores, 181793 Dr., Lillian Brown, 67251 Figure 1.b: A sample of the text file 'employees.txt" Figure 1.a: A sample of the text file 'employees.txt' without…arrow_forwardThe read position advances towards the end of the file when items from the file are read. the report True or False:arrow_forward
- Python - Next Birthdate In this task, we will write a program that reads birthdate data from a given CSV file, and given the current date, determines which person's birthday will be celebrated next. Create a function with the following signature: nextBirthdate(filename, date) filename: parameter, which represents the CSV filename. date: parameter, which represents the current date. The function should open the CSV file, read the birthdate data, and determine which person's birthday will be celebrated next, given the current date. The name of the person should be returned. In other words, given a date, find the person whose birthday is next. Sample Run birthdates.csv Draven Brock, 01/21/1952 Easton Mclean, 09/02/1954 Destiny Pacheco, 10/10/1958 Ariella Wood, 12/20/1961 Keely Sanders, 08/03/1985 Bryan Sloan,04/06/1986 Shannon Brewer, 05/11/1986 Julianne Farrell,01/29/2000 Makhi Weeks, 03/20/2000 Lucian Fields, 08/02/2018 Function Call nextBirthdate("birthdates.csv", "01/01/2022") Output…arrow_forwardThe seekg function parameter does not include A. positionB. offsetC. dirD. file pointerarrow_forwardConstraints: Use Python Don't use global variables Don't use external libraries (PIL and os are allowed) Start the program with a main function (def main():) Content: Ask the user for an input (an image file). If the file uploaded is not a jpeg/jpg file, print out "Try again!" and ask for an input once more. Continuously ask until a jpeg/jpg file is uploaded. Once a jpeg file is uploaded, create a function with the argument img_info and return a tuple with the image's dimensions in pixels (w, h) and the image data in a form of a list of tuples with RGB values. Print out the values/data collected. Thank you!arrow_forward
- Phresh Ladies Makeup Line and We are Ladies Co. are merging their businesses and want to merge their product files. Each file contains a product number, name, quantity, and price, and each file is arranged by product number accordingly. Design the logic for a program using pseudocode that merges the two files into one file containing all products. Assume that all product numbers are unique.arrow_forwardPython Program Language Write a program that takes in a sentence a user inputs, turns in into title case and appends it to a file on a new line called title.txt. At the end of the sentence add the word count.arrow_forwardhome / study / engineering ! somputer science / computer science questions and answers / g/write a m-file matlab program call it eg2mfile withou Question: Q/Write a m-file matlab program call it Eq2.mfile without using... Q/Write a m-file matlab program call it Eq2.mfile without using sum command find the summation of any matrix(a)?arrow_forward
- True or FalseAs items are read from the file, the read position moves forward, toward the end of the file.arrow_forwardType in C Make sure the student ID shows for each line please.arrow_forwardSEARCH CANDIDATE BY QUALIFICATION Search an Election Candidate Write a program to display the election candidate details from the file to the console. Read the qualification detail from the console and search the candidates corresponding to the qualification from the file and display the details. Format of the file.txt file Rajkumar,32,BSc,Chennai Chandrabose,30,BEd,Chennai Tamil Selvan,27,BSc,Chennai Ramkumar, 26,BE,Chennai Selvan,27,BEd,Chennai Pratap Raj,34,BSc,Chennai Input Format: First line of the input consists of qualification. Output Format: Display the Election Candidate Detailsarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr