Question

Hello! I desperately need help with this project for my computer science class c++. Please let...

Hello! I desperately need help with this project for my computer science class c++. Please let me know if any clarification or additional information is needed. Compliance with the outlined project requirements is crucial. Thank you!!! and I'll rate you up too thank you!

1) Program must implement a minimum of 3 classes (which we will learn about in Ch.13).

2) You should make use of plenty of the concepts that we have learned or are learning in class (for example, arrays, looping, conditional statements, classes, pointers or references, type casting, etc).

3) Code must be commented, indented, spaced out and formatted nicely, with meaningful variable names, as we have seen in the labs.

4) Include a Makefile for compiling the code (text file).

5) You should include a readme file with an explanation of how to run the software. The readme file should also include all author names and date (text file). Include all the information that's in your mind about how to run the software in the readme file.

6) Include documentation with a flowchart to explain the program logic. This could be in a Word or Powerpoint file or just put it in the code , for instance. Indicate the developers and the contribution of each developer.

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

/* Here is a simple program that allows you to create a cricket team of your choice, Firstly you need to enter the total number of players you want in your team and then batsmen and bowlers data one by one.

Once you are done with entering the data, the program will calculate and display the strike-rates of all the batsmen and also it will calculate and display the economy rates of all bowlers.

The concept of inheritance is also used in the program ( class Bowler and Batsmen inherits the properties of class Player (name, age and no_of_matches).

*/

#include<iostream>
using namespace std;
class player
{
   public:
       string name;
       int age;
       int no_of_matches;
  
  
};
class batsmen:public player //inhriting player properties(name,age,no_of_matches)
{
   public:
       int run_scored;
       int balls_played;
       int no_of_fifties;
       int no_of_centuries;
      
};
class bowler:public player
{
   public:
       int no_of_overs;
       int run_conceded;
       int no_of_wickets;
       int no_of_maiden;
      
};
void strike_rate(int balls,int runs, float &rate) //used referencing &rate
{
   rate=((float)runs/(float)balls)*100; //type casting int -> float
}
void economy_rate(int wickets, int runs, float &economy)
{
   economy=(float)runs/(float)wickets; //type casting
}
int main()
{
   int i,n,m,x;
   float rate,economy;
   cout<<"Enter total no. of players in your team: ";
   cin>>x;
   abc:cout<<"Enter no. of batsmen in your team: ";
   cin>>n;  
   cout<<"Enter no. of bowlers in your team ";
   cin>>m;
   if(n+m!=x)           //conditional statement
   {
       cout<<"Total no. players should be "<<x<<endl;
       goto abc;
   }
   batsmen b[n]; //array of class objects
   bowler bo[m];
   cout<<"Enter batsmen data as (name age no_of_matches run_scored balls_played no_of_fifties no_of_centuries) --> "<<endl;
   for(i=0;i<n;i++) //looping
   {
       cout<<"Batsmen "<<i+1<<" : ";
       cin>>b[i].name>>b[i].age>>b[i].no_of_matches>>b[i].run_scored>>b[i].balls_played>>b[i].no_of_fifties>>b[i].no_of_centuries;
   }
   cout<<"Enter bowler data as (name age no_of_matches no_of_overs run_conceded no_of_wickets no_of_maiden) --> "<<endl;
   for(i=0;i<m;i++)
   {
       cout<<"Bowler "<<i+1<<" : ";
       cin>>bo[i].name>>bo[i].age>>bo[i].no_of_matches>>bo[i].no_of_overs>>bo[i].run_conceded>>bo[i].no_of_wickets>>bo[i].no_of_maiden;
   }  
   cout<<endl<<"Strike-rate of batsmen in your team"<<endl;
   for(i=0;i<n;i++)
   {
       strike_rate(b[i].balls_played,b[i].run_scored,rate);
       cout<<b[i].name<<" -> "<<rate<<endl;
   }
   cout<<endl<<"Economy rate of bowlers in your team"<<endl;
   for(i=0;i<m;i++)
   {
       economy_rate(bo[i].no_of_wickets,bo[i].run_conceded,economy);
       cout<<bo[i].name<<" -> "<<economy<<endl;
   }
}

Output:

Add a comment
Know the answer?
Add Answer to:
Hello! I desperately need help with this project for my computer science class c++. Please let...
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
  • Desperately need help with this one thank you and I'll rate you up after thanks : ) Please let me know if any clarif...

    Desperately need help with this one thank you and I'll rate you up after thanks : ) Please let me know if any clarification or additional information is needed. Compliance with the outlined project requirements is crucial. In this question you should program something of your choice but if possible our professor said to make a program that store account number and balance thank you Project: Programming a project of your choice in C++. Step 1- Program must implement a...

  • Desperately need help with this one thank you and I'll rate you up after thanks :...

    Desperately need help with this one thank you and I'll rate you up after thanks : ) Please let me know if any clarification or additional information is needed. Compliance with the outlined project requirements is crucial. In this question you should program something of your choice but if possible our professor said to make a program that store account number and balance thank you Project: Programming a project of your choice in C++. Step 1- Program must implement a...

  • Hello, I ran into some issues with my code and wanted to ask if anyone can...

    Hello, I ran into some issues with my code and wanted to ask if anyone can help me fix them. Thank you in advance! Question: You and your team of software developers are experiencing problems saving the state of a program between different times that the program is run. An object oriented program state can be maintained by saving the state of the objects in the program. Also, you can transfer the state of an object between different computer systems...

  • You need to implement a queue based on the doubly linked list. (In C++) **PLEASE follow...

    You need to implement a queue based on the doubly linked list. (In C++) **PLEASE follow the format** **Don't worry about the readme.txt** THANK YOU SO SO MUCH! You have to implement the doubly linked list in DList.h and DList.cpp and the queue in the LinkedQueue.h and LinkedQueue.cpp; all as template classes. You have to provide the main.cpp file as we discussed in class to allow the user to interact with your queue using enqueue, dequeue, front, back, size, empty,...

  • OUTPUT MUST MATCH THE IMAGE TO THE TEE. I have the majority of the program written,...

    OUTPUT MUST MATCH THE IMAGE TO THE TEE. I have the majority of the program written, just having issues with the output. Please make sure to have the right alignment, variable data types and number padding/decimals as shown below! ​ MUST BE IN C NOT C++/C#! Assume the Item Num is an int that must be padded with zeros (ex: 1234 ---> 00001234) Write a C program for a shopping list to run on ocelot. Use the listed items and...

  • need help with c++ project: For the project. Create a c++ program about bus booking and...

    need help with c++ project: For the project. Create a c++ program about bus booking and ticketing system that - This system also needs you to key in your username and password precisely and ask again to confirm your booking of the bus ticket, and output of the ticket fully displayed -Must include selections, looping and functions, and array. - minimum of 6 functions including main function Keywords that should not be in the source code: class, struct, fstream, ifstream,...

  • Please help ASAP! C ++, linked list, etc. everything for the project is in the link...

    Please help ASAP! C ++, linked list, etc. everything for the project is in the link below. https://www.zipshare.com/download/eyJhcmNoaXZlSWQiOiIzZDIyN2UzYi1kNGFhLTRlMzEtYjMzZi00MDhmYzNiMjk3ZGMiLCJlbWFpbCI6Im1pMTQzNEBnbWFpbC5jb20ifQ== You should turn it in by blackboard. Each task should be in a separate unzipped folder named YourLastName_YourFirstInitial_taskN, where N is the task number inside a zipped file named: YourLastName_YourFirstInitial.zip. You may use code you have written previously and you may ask other members of the class questions about the assignment. However, you must do your own assignment; you may not use...

  • hello, I'm having trouble understanding the problems below for my Computer science class, please include a...

    hello, I'm having trouble understanding the problems below for my Computer science class, please include a work-through and some explanations on how to do it so that I can understand remember how do problems like this on my own. Thank you very much WE ARE USING C++ The following project includes the frequency_start_letter function and a few other functions that work with a string array. Reminder: you could click "Open in Repl.it" on the top right corner to see the...

  • Hello, I need help with these two functions blockPrint and wordPrint.The program is written in C....

    Hello, I need help with these two functions blockPrint and wordPrint.The program is written in C. Thank you. ent the prototype for blockPrint. a) Intextfunctions.h, uncon Write the function definition for block Print dentical characters on a separate line. (See example This function should print each group (block) of ident output below) Example: Example: Incoming string: "Tbeehiklssuy Output (to the screen): Incoming string: "Java Programming Output to the screen: ee POOH da al Edit vour main function.include test calls and...

  • C++ project we need to create a class for Book and Warehouse using Book.h and Warehouse.h header ...

    C++ project we need to create a class for Book and Warehouse using Book.h and Warehouse.h header files given. Then make a main program using Book and Warehouse to read data from book.dat and have functions to list and find book by isbn Objectives: Class Association and operator overloading This project is a continuation from Project 1. The program should accept the same input data file and support the same list and find operations. You will change the implementation of...

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