• Congratulations to the Class of 2024 on your results!
    Let us know how you went here
    Got a question about your uni preferences? Ask us here

comp115 assignment 1 (1 Viewer)

sladj

New Member
Joined
Feb 12, 2004
Messages
9
Location
sydney
Gender
Male
HSC
2004
Does any1 knwo hwo to do comp115 assignemtn i got no freaken clue.......


Introduction
Basketball is a game played by two teams over 4 quarters of 12 minutes each.

Given the score of the two teams at some point in the match, it is possible to give an estimate of the score at the end, assuming that the points are scored at the same rate on average.

Your Task
The goal of this assignment is to complete a C++ program that reads from the user


- - The current quarter (1,2,3 or 4)

- - The remaining time to play in this quarter (in min and sec)

- - The score of the home team

- - The score of the away team


The program should then be able to determine what should be the scoreboard at the end.

Since we do not expect this method to be very precise, the program should output the scores rounded to the nearest multiple of 5.

Note that 2.5 should be rounded to 5.

Note that the format of your output should be exactly similar to the one of examples given below (in particular the presentation and indentation should be the same).

Examples
Here are some sample inputs and outputs to the program basket.exe:

Sample 1:

Enter the initial quarter: 1

Enter the remaining time (min sec): 5 58

Enter the score of the away team: 12

Enter the score of the home team: 14

|-----------|

| Q 4 |

| 00:00 |

|-----------|

|95 | 110|

|-----------|

Press CTR-C to Leave...

Sample 2:

Enter the initial quarter: 3

Enter the remaining time (min sec): 10 12

Enter the score of the away team: 55

Enter the score of the home team: 52

|-----------|

| Q 4 |

| 00:00 |

|-----------|

|100 | 95|

|-----------|

Press CTR-C to Leave...

http://online.mq.edu.au/pub/COMP115/assignments/ass1/ass1.html
 

...

^___^
Joined
May 21, 2003
Messages
7,723
Location
somewhere inside E6A
Gender
Male
HSC
1998
thats some 1337 copying & pasting there!


theres a thread somewhere created recently on the problem..have a search and read some of the posts :)
 

redruM

Breathe and Stop
Joined
May 11, 2004
Messages
3,954
Gender
Male
HSC
2003
Maybe someone should complete it, and upload the exe file, just to piss them off? :p
 

CrashOveride

Active Member
Joined
Feb 18, 2004
Messages
1,488
Location
Havana
Gender
Undisclosed
HSC
2006
Hi,

For a $30/hr fee I could arrange for the assignment to be completed.
 

sladj

New Member
Joined
Feb 12, 2004
Messages
9
Location
sydney
Gender
Male
HSC
2004
maybe u wanan go down oxford street or soem shit... maybe they pay ya... damncunt :burn:
 

shole

New Member
Joined
Mar 9, 2006
Messages
10
Gender
Male
HSC
N/A
probably use floor to round to nearest 5
everything else seems straightforward
 

Hobbsee

Member
Joined
May 3, 2004
Messages
50
Location
Sydney
Gender
Female
HSC
2005
It's really not that hard...

Think about it, and the solution falls into place...

I'm not kidding - and i'm not a great computer programmer or something either.

Hint: look at the rate of scoring the goals, then the rest is simple.
 

sladj

New Member
Joined
Feb 12, 2004
Messages
9
Location
sydney
Gender
Male
HSC
2004
here is my code so far has some bugs and sht i dunno y....

#include<iostream>
#include<iomanip>
#include<cmath>
#include "cmath.h"
using namespace std;

int main()
{

int quarter; // The number of the quarter
int mins_remain, secs_remain; // Time remaining in this quarter
float home_score, away_score; // Current scores
float home_estimate, away_estimate; // Estimated scores at the end of the match

int quarter_length = 90; // Length of a quarter in
minutes

cout << "Please enter the quarter number : ";
cin >> quarter; // Add more lines like this

int total_seconds = 4 * quarter_length * 60; // Length of the entire
game in seconds
int elapsed_seconds = (quarter - 1) * quarter_length * 60 + mins_remain * 60 + secs_remain;
float fraction = elapsed_seconds / (total_seconds + 0.0);

home_estimate = home_score / fraction;
away_estimate = away_score / fraction;

cout << "Estimated final home score : " << 5 * floor(home_estimate / 5.0 + 0.5);
cout << "Estimated final away score : " << 5 * floor(away_estimate / 5.0 + 0.5);

cout << "Press CTR-C to Leave..." << endl;
pause();
return 0;
}
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top