1. Make a structure for the bowlers(write the program and test it also). It woul
ID: 3559977 • Letter: 1
Question
1. Make a structure for the bowlers(write the program and test it also). It would have a string for a name, and 3 integers for the scores, and a double for the average.
You should be able to get, set, calculate, and print the data.
The data should be checked for being in the range of 0 to 300 . If the data is out of range, put 0 in place of the score.
Enter the following data for bowler one from the keyboard:
your name, 200, 300, 100
call the get, set, calculate, and print methods
Enter the following data for bowler 2:
lucy, 100, 300, 400
call the get, set, calculate, and print methods
2. Make a structure for a student. String for name, int for age, char for level(f for freshman, s for sophmore, j for junior, r for senior)
Create methods for get, set, and print
Enter the following data from the keyboard:
your name, 19, s
Check to make sure he has a valid grade level(use a switch)
Check to insure the age is in the range of 0 to 120
Explanation / Answer
/*Program 1*/
/*Output*/
[root@RTHSS68(11:06:09) : chegg]# ./a.out
Enter the data for Bowler1:
Enter Bowler Name:pankaj
Enter the 3 scores:100 100 50
Enter the data for Bowler2:
Enter Bowler Name:jangir
Enter the 3 scores:100 30 20
Bowler Name :pankaj
Socres are: 100 100 50
Average : 250
Bowler Name :jangir
Socres are: 100 30 20
Average : 150
/*Program 2*/
/*Output*/
[root@RTHSS68(11:09:05) : chegg]# ./a.out
Enter the data from keyboard:
Enter student name:pankaj
Enter age b/w 0 to 200:20
Enter level f/s/j/r:f
student name:pankaj
age:20
level:f
Name:pankaj
Age :20
Level:f
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.