Write a program that reads the student information from a tab separated values (tsv) file. The program then creates a text file that records the course grades of the students. Each row of the tsv file contains the Last Name, First Name, Midterm1 score, Midterm2 score, and the Final score of a student. A sample of the student information is provided in StudentInfo.tsv. Assume the number of students is at least 1 and at most 20.
The program performs the following tasks:
Read the file name of the tsv file from the user.
Open the tsv file and read the student information.
Compute the average exam score of each student.
Assign a letter grade to each student based on the average exam score in the following scale:
A: 90 = < X o
B: 80 = < x < 90
C: 70 = < X < 80
D: 60 = < x < 70
E: X < 60
• Compute the average of each exam.
• Output the last names, first names, exam scores, and letter grades of the students into a text file named report.txt. Output one student per row and separate the values with a tab character.
• Output the average of each exam, with two digits after the decimal point, at the end of report.txt. Hint: Use the setprecision manipulator to format the output.
Ex: If the input of the program is:
StudentInfo.tsv
and the contents of StudentInfo.tsv are: 70 45 59
Barrett Edan 96 97 88
Bradshaw Reagan 73 94 80
Charlton Caius 88 61 36
Mayo Tyrese 90 86 45
the file report txt should contain
Barrett Edan 70 45 59 F
Baadha Boagan 9e 157 89 A
Charlton Caius 73 94 80 B
Mayo and Tyrese 58 61 36 D
Stern and Brenda 90 36 45 C
Average midterm 83.40, midterm2 76.60, final 61.60
In this exercise we have to use the knowledge of the JAVA language to write the code, so we have to:
The code is in the attached photo.
So to make it easier the code can be found at:
using namespace std;
// Class student required to store the data
class Student{
public:
string lname;
string fname;
int marks[3];
char grade;
// Function which generates the grade for student
void calculate_grade(){
double sum = 0;
for(int i=0;i<3;i++){
sum+= marks[i];
}
double average = sum/3;
if(average>=90 && average<100)
this->grade = 'A';
else if(average>=80)
this->grade = 'B';
else if(average>=70)
this->grade = 'C';
else if(average>=60)
this->grade= 'D';
else this->grade = 'F';
}
};
// This function reads the file , and creates a vector of Students data
vector read_file(string fileName){
// Opening the file
fstream fin;
fin.open(fileName);
// Temp variables
vector list;
vector row ;
string line, word, temp;
// Read the data into vector
while(getline(fin,line)){
row.clear();
stringstream s(line);
while(getline(s,word,'\t')){
row.push_back(word);
}
Student st;
st.fname = row[0];
st.lname = row[1];
st.marks[0] = stoi(row[2]);
st.marks[1] = stoi(row[3]);
st.marks[2] = stoi(row[4]);
st.calculate_grade();
list.push_back(st);
}
fin.close();
return list;
}
// This function takes filname to be output as input, and list of student
void writeFile(string filename, vector list){
// Opening the new file
ofstream fin(filename);
for(int i=0;i string line = list[i].fname+"\t"+list[i].lname+"\t"+to_string(list[i].marks[0])+"\t"
+to_string(list[i].marks[1])+"\t"+to_string(list[i].marks[2])+"\t"+list[i].grade+"\n";
fin<
}
// Find the stats required
double average1 =0,average2 =0 ,average3 = 0;
for(int i=0;i average1+=list[i].marks[0];
average2+=list[i].marks[1];
average3+=list[i].marks[2];
}
average1/=list.size();
average2/=list.size();
average3/=list.size();
// Writting the stats
fin<<"\n"<<"Average: "<<"mid_term1 "<
// Closing the file
fin.close();
}
int main(){
// Taking the input
cout<<"Enter the filename: ";
string filename;
cin>>filename;
vector list;
// Reading and Writting to the file
list = read_file(filename);
writeFile("report.txt",list);
}
See more about JAVA at brainly.com/question/2266606
Apart from using secure networks, how else can Dhruv keep his deliverables safe in the office and on the go? Select all that apply.
It should be noted that data can be secured when working in the following way:
Establishing a cyber security policy.Using two-factor authentication.Keeping passwords strong.Using secure internet connections.Your information is incomplete. Therefore, an overview relating to the topic will be given. It should be noted that as telecommuting becomes a standard practice, the challenge regarding data security increases.
Employers should educate their employees about data security. The workers should know that data security is a priority and that all the internet connections are secure.
Learn more about data security on:
https://brainly.com/question/10091405
what is office course
how to learn office course
Answer:
It includes Word, to create, polish, and share documents; Excel, to analyze and visualize data; PowerPoint, to create, collaborate, and effectively present ideas; OneNote, to organize ideas into a digital notebook; Outlook, to organize email, coordinate schedules, and stay up to date with contacts; Access, to create .Hope this helps you XD ✌️what is a survey? plz hel
Answer:
The act of seeing and recording information.
Answer:
a method of collecting data tell me if i'm wrong or right plz
Explanation:
Meenakshi has created a presentation of six slides. The slides have the same background, but s wants to change the background of each slide. Which option can help her in doing so?
You are given an array of integers. Your task is to create pairs of them, such that every created pair has the same sum. This sum is not specified, but the number of created pairs should be the maximum possible. Each array element may belong to one pair only.
Write a function
class Solution public int
solution (int[] A); }
that, given an array A consisting of N integers, returns the maximum possible number of pairs with the same sum.
Examples:
1. Given A = [1, 9, 8, 100, 2], the function should return 2. The pairs are (A[0]. A[1]) and (A[2], A[4]); the sum of each pair is 10.
2. Given A = [2, 2, 2, 3], the function should return 1. Although, for instance, A[0]+A[1] = A[0]+A[2], the pairs (A[0], A[1]) and (A[0], A[2]) cannot exist at the same time, because they both contain a common element, A[0].
list 3 things needed in order to complete mail merge process.
pls help me!
What is it called when a unique letter is assigned to a shared drive
Answer:
Assigning a drive letter to a network drive is called mapping the drive, or linking the drive, by network nerds.
Explanation:
So has anyone opened the link/file those people are giving out as answers? Like what are they, viruses, answers, nothing??? Someone that has opened one tells me what it was and what happened because I am to scared to open it.
Answer:
They're viruses that why they answer so quick and get deleted quickly
A(n) __________ is a system where banks in the United States eventually figured out that they could print more __________ than the gold that they had in their vaults.
Based on the information given regarding money, the correct option will be fractional reserve; paper money.
It should be noted that in the United States, there are banking institutions that hold reserves which is simply the fraction of deposits of other banks.
The fractional reserve is equal to the fraction of the bank's deposit liabilities that are owed to customers.
Therefore, a fractional reserve is a system where banks in the United States eventually figured out that they could print more paper money than the gold that they had in their vaults.
Learn more about money on:
https://brainly.com/question/24556197
list different examples of models
Answer:
Planet 3D model
Chemical reactions on a computer simulation
Flowchart of how science has changed over time
Tectonic plate movement in a drawing or picture
Making an Atom cake (i've done it and it was fun)
Earth foam Structure with a quarter or it cut out to show the inside
C++
see attached file for quesion
what is the relationship between interrupt and buffer
Answer:
Operating systems have some code called an 'interrupt handler', which prioritises the interrupts and saves them in a queue. Buffers are used in computers as a temporary memory area, and they are essential in modern computers because hardware devices operate at much slower speeds than the processor.
please write an Introduction on intrusion detection system and prevention system
PLEASE
Answer:
An Intrusion Detection System (IDS) is a system that monitors network traffic for suspicious activity and issues alerts when such activity is discovered. It is a software application that scans a network or a system for harmful activity or policy breaching. Any malicious venture or violation is normally reported either to an administrator or collected centrally using a security information and event management (SIEM) system. A SIEM system integrates outputs from multiple sources and uses alarm filtering techniques to differentiate malicious activity from false alarms.
Responsible manner in video and audio conferencing
Answer:
1.Mute yourself when not speaking.
2.Be on time.
3.Ensure your technology works correctly.
4.Use technology to fully engage remote participants.
Explanation:
Please hurry, it's a test! 30 POINTS. :)
What computing and payment model does cloud computing follow?
Cloud computing allows users to_____ computing resources and follows the ______
payment model.
1. Buy, Own, Rent, Sell
2. pay-as-you-go, pay-anytime-anywhere, pay-once-use-multiple-times
When defining a system
landscape, the following are all
necessary to operate the ERP
system,
except
Select one:
O a. Techincal expertise.
O b. Computer hardware.
O c. Networking hardware.
O d. None of the above.
O e. All of the above.
All of the given answer options are necessary to operate the enterprise resource planning (ERP) system when defining a system landscape.
Enterprise resource planning (ERP) can be defined as a business strategy process through which business firms manage and integrate the main parts of their day-to-day business activities by using software applications.
The main objective and purpose of an enterprise resource planning (ERP) system is to significantly reduce costs by integrating all the operations of a business firm.
In Computer science, when defining a system landscape, all of the following are necessary to operate the enterprise resource planning (ERP) system:
Technical expertiseComputer hardwareNetworking hardwareRead more on ERP system here: https://brainly.com/question/25752641
Arrange the following steps in an appropriate order for program execution:
- Step A: translates the source code into the target machine code
- Step B: preprocesses the source code
- Step C: writes the source code
- Step D: links object code to other library files
Which one is correct:
A) D, C, B, A
B) C, A, D, B
C) A, B, C, D
D) C, B, A, D
The best arrangement of the following steps in an appropriate order for program execution is:
D) C, B, A, DAccording to the given question, we are asked to give the best arrangement of the following steps in an appropriate order for program execution
As a result of this, we can see that when a person is writing a code, he would have to first write the source code, then preprocess it, before he translates it into the target machine code before finally linking the object code to other library files
Therefore, the correct answer is option D
Raad more about source code here:
'https://brainly.com/question/4593389
challenge encountered
Answer:
What challenge?
Explanation:
Explain if a company is responsible for using computer components manufactured using fair trade practices. [9 marks]
Answer:
Fair trade practices aims at promoting the fair relationships between the buyers and producers. It is a kind of a social movement that makes the producers to provide the better conditions and humane working environment in case of developing countries.
• It also favors and supports the proper and substantial payment to the manufacturers and wages to the labors.
• It is a trading partnership that states the manufacturers to analyze and check their supply sources or resources and provide disclosure if the materials were produced or mined in the areas of conflict or areas of extreme poverty.
Explanation:
can you mark me as brainlist
Answer:
It is a trading partnership that states the manufacturers to analyze and check their supply sources or resources and provide disclosure if the materials were produced or mined in the areas of conflict or areas of extreme poverty.
Which statement, if any, about Boolean is false?
a. They are all true.
b. Boolean is one of the four data types.
c. All expressions in python have a Boolean value.
c. The Boolean values are True and False.
Answer:
A.
Explanation:
Matching parentheses. An math expression may have a number of parentheses like (, ), [, ], { and }. Each openning parenthesis (, or [, or { must be macthed by a corresponding closing parenthsis ), or ] or }. For example, 12 { 34 / [ 6 * ( 55 - 10 ) / ( 100 20 ) ] } has matched pairs of parentheses, while 12 { 34 / ( 6 * ) ] } does not. Write a function to check whether an input math expression has matched parentheses. The header of the function is given as follows:
bool match( const char exp [ ], const int s);
The input math express is store in the char array exp, and the size of exp is s. It returns true if all parentheses are matched or false otherwise.
Your job is to protect your company's information assets. What security objectives
should you address?
1) Assets, liabilities, and threats
2) Common vulnerabilities and exposures
3) Confidentiality, integrity and availability
4) Risks, threats and vulnerabilities
Answer:3
Explanation: The CIA Triangle is the basis of all Security related needs.
b) What is system software? Write its importance.
Answer:
System software is software designed to provide a platform for other software. Examples of system software include operating systems like macOS, Linux, Android and Microsoft Windows, computational science software, game engines, search engines, industrial automation, and software as a service applications.
Explanation:
a
2 A car is fitted with the latest GPS navigation system. This device is controlled
by an embedded system in the form of a microcontroller.
Describe the inputs needed by the embedded system and describe which
outputs you would expect it to produce.
b Since updates to the GPS device are required every six months, explain how
the device is updated without the need to take the car to the garage every six
months.
Answer:
It probaly connected to the internet in some way to resieve updates
Hope This Helps!!!
Tim Berners-Lee cultivated a way to interconnect and self-index data. He made a major contribution to the development of the Internet by creating _____.
A. graphic data
B. emoticons
C. the hyperlink
D. digital data
x = 9 % 2
if (x == 1):
print ("ONE")
else:
print ("TWO")
Answer:
Hewo There!!
_______________________
Simplify 9 % ⋅ 2 .
x = 0.18
_______________________
“One’s life has value so long as one attributes value to the life of others, by means of love, friendship, indignation and compassion.” — Simone De Beauvoir
_______________________
Think of life as a mytery because well it sort of is! You don't know what may happen may be good or bad but be a little curious and get ready for whatever comes your way!! ~Ashlynn
Every device connected to the public Internet is assigned a unique number known as: a. an Internet Protocol (IP) addres
Answer:
yes
Explanation:
its the number used to identify the devise connected to the internet
Where is the option to set Conditional Formatting rules found?
O Insert tab in the Formatting group
O Page Layout tab in the Styles group
O Home tab in the Styles group
Formulas tab in the Formatting group
Answer:
C
Explanation:
the person above me is correct, you should mark them brainliest
What is the result of the following code?
x=7//2+10%2**4
print(x)
Answer:
3
Explanation:
We can split the expression into two sections
First Section:
7 // 2 = 3. Using the floor division we only utilize the integer part.
Second Section:
10 % 2**4 = 0**4 = 0
Bringing back the full version expression we have
3 + 0 = 3