Question

Write a program in C++ Lightening Lanes Case Study Problem Statement On Tuesday afternoons, Lightening Lanes...

Write a program in C++

Lightening Lanes Case Study

Problem Statement
On Tuesday afternoons, Lightening Lanes Bowling Alley runs a special class to teach children to bowl.
Each lane has an instructor who works with a team of four student bowlers and instructs them as they bowl
three lines (games). The management of Lightening Lanes has asked you to develop a program that will
report each student’s 3-game average score and compare it to the average score they bowled the previous
week. In this way, the students can see how much they are improving. The program will utilize looping
structures and data validation techniques you learned in Chapters 1-5.

Input: Input should come from the keyboard, using suitable prompts. First the team name should be
entered. Then, for each of the four students on the team, the program should input their name, their
previous week’s average score, and their score from each of today’s games. The score for each game must
be between 0 and 300.

Output: Output should be written to a file. It should be in the form of a report that lists the team
name, each student’s name, their 3-game average from last week, and their 3-game average from today.

Program Design
General Pseudocode
The following general pseudocode lists the steps the program must carry out.
Open the output file
Input the team name
Print report heading which includes team name
For each of the 4 students
Input the student’s name
Input and validate their last week’s bowling average
Input, validate, and add up each of their game scores from today
Print student name, last week’s average and today’s calculated average
End for
Close the file

Variables Whose Values Will be Input
string teamName // the team name
name // a student’s name
double oldAvg // a student’s previous week’s averages
score // a student’s score for 1 game

Variable Whose Value Will be Accumulated
int total // a student’s total 3-game score

Detailed Pseudocode (including actual variable names and needed calculations)
Open the output file
Input teamName
Print report heading which includes teamName
For each of the 4 students
total = 0
Input name, oldAvg
While oldAvg < 0 or oldAvg > 300
Print error message
Input oldAvg
End While
For each of today’s 3 games
Input score
While score < 0 or score > 300
Print error message
Input score
End While
total = total + score
End For
Print name, oldAvg, total / 3.0
End For
Close the file

The Program
The next step, after the pseudocode has been checked for logic errors, is to expand the
pseudocode into the final program. The source code listing for this program follows

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Your code goes here:

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace gamescoreAveragetoFileconsole
{
class Program
{
  
//Declaring the required class variables
string teamName;
string studentName;
double oldAverage;
double newAverage;
double totalScore;



  
static void Main(string[] args)
{

//Declaring the list of program class objects
List<Program> listofObjects = new List<Program>();

for (int i = 0; i < 4; i++)
{

Program pgmObj = new Program();

Console.WriteLine("Team Name");
pgmObj.teamName = Console.ReadLine();

Console.WriteLine("student Name");
pgmObj.studentName = Console.ReadLine();

Console.WriteLine("Old Average");
pgmObj.oldAverage = Convert.ToDouble(Console.ReadLine());

Console.WriteLine("total socre");
pgmObj.totalScore = Convert.ToDouble(Console.ReadLine());

// Calculating the new average
pgmObj.newAverage = pgmObj.totalScore / 3;
  
//Adding the Program objects to the list
listofObjects.Add(pgmObj);

  
}

//writting the list of objects one by one to the text document
using (var writer = new StreamWriter("C:\\doc.txt"))
{
// Loop through 4 variables
for (int i = 0; i < 4; i++)
{

writer.Write(listofObjects[i].teamName + "\r\n" + listofObjects[i].studentName + "\r\n"+"Last week's avaerage" + listofObjects[i].oldAverage+"\r\n" +"Today's average" + listofObjects[i].newAverage + "\r\n" );   
writer.Write("\r\n");

}
}
  


}
}
}

Add a comment
Know the answer?
Add Answer to:
Write a program in C++ Lightening Lanes Case Study Problem Statement On Tuesday afternoons, Lightening Lanes...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Lightening Lanes Case Study Problem Statements On Tuesday afternoons, Lightening Lanes Bowling Alley runs a special...

    Lightening Lanes Case Study Problem Statements On Tuesday afternoons, Lightening Lanes Bowling Alley runs a special class to teach children to bowl. Each lane has an instructor who works with a team of four student bowlers and instructs them as they bowl three lines (games). The management of Lightening Lanes has asked you to develop a program that will report each student’s 3-game average score and compare it to the average score they bowled the previous week. In this way,...

  • Football Game Scores Write a C++ program that stores the following data about a football game...

    Football Game Scores Write a C++ program that stores the following data about a football game in a structure: Field Name Description visit_team string (name of visiting team) home_score int visit_score int The program should read the number of games from a data file named “games.txt”, dynamically allocate an array of structures for the games using one structure for each game, and then read the information for each game from the same file (visiting team, home score, visiting team’s score)....

  • Write a complete C++ program that reads students names and their test scores from an input...

    Write a complete C++ program that reads students names and their test scores from an input text file. The program should output each student’s name followed by the test scores and the relevant grade in an output text file. It should also find and display on screen the highest/lowest test score and the name of the students having the highest/lowest test score, average and variance of all test scores. Student data obtained from the input text file should be stored...

  • Write a C program to compute average grades for a course. The course records are in...

    Write a C program to compute average grades for a course. The course records are in a single file and are organized according to the following format: Each line contains a student’s first name, then one space, then the student’s last name, then one space, then some number of quiz scores that, if they exist, are separated by one space. Each student will have zero to ten scores, and each score is an integer not greater than 100. Your program...

  • c++ The program will be recieved from the user as input name of an input file...

    c++ The program will be recieved from the user as input name of an input file and and output.file. then read in a list of name, id# and score from input file (inputFile.txt) and initilized the array of struct. find the student with the higher score and output the students info in the output file obtain the sum of all score and output the resurl in output file. prompt the user for a name to search for, when it find...

  • CIS 22A C++ Project Exam Statistics Here is what your program will do: first it welcomes...

    CIS 22A C++ Project Exam Statistics Here is what your program will do: first it welcomes the user and displays the purpose of the program. It then prompts the user to enter the name of an input file (such as scores.txt). Assume the file contains the scores of the final exams; each score is preceded by a 5 characters student id. Create the input file: copy and paste the following data into a new text file named scores.txt DH232 89...

  • Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment...

    Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by...

  • In this assignment, you will write a program in C++ which uses files and nested loops...

    In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...

  • Create an algorithm design (you may use a flowchart and/or pseudocode) AND the Python program to...

    Create an algorithm design (you may use a flowchart and/or pseudocode) AND the Python program to determine the winning team for Virginia Tech's Bowling League. There are 8 members per team and 12 teams in the league. Each bowler needs their score (between 0 and 300) to be entered. The winning team is found by determining the highest average score. Output the team’s name and average that wins the competition.

  • c++ reading file that contains names and scores to compute averages, return scores when names are inputed and return if a students scores is aobve equal to or below the average

    Given a score file named as scores.txt, the named file is posted alone side with the assignment. The score file has two part: first line is number of students and the rest is a list of names with scores. For example: 3 Tommy 35.5 John 77.2 David 59.4 The first function should be named as getScore and it takes a string parameter as input that is a student’s name, you then open the given score file, read the contents and return the student’s score stored in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT