# Need Help with Homework

This topic is 2085 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm not sure if this is the write place for these kind of questions but it's the only forum I know at the moment for programming (i've heard of dreamincode but never been there personally). Basically, I need to create a class that works with this code:

#include<iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;

const int DAYS_IN_PERIOD = 7;

int main()
{
double snow_inches[7];

for(int i=0; i < 7; i++)
snow_inches[i] = (double(rand() % 60)) / 3;

SnowData snow_data("January", 12, 19, snow_inches);

snow_data.sortByInches();
cout << "--------- Sorted by Inches ---------\n";
snow_data.print();

snow_data.sortByDate();
cout << "---------- Sorted by Date -------\n";
snow_data.print();

cout << "Average snowfall = " << setprecision(2)
<< snow_data.getAverage() << " inches\n";

return 0;
}


This is the assignment:

Write a program that can be used by a ski resort to keep track of local snow conditions for one week. It should have a seven-element array of structures, where each structure holds a date and number of inches of snow in the base on that date. The program should have the user input the name of the month, start and end dates of the seven day period being measured, and then the seven base snow depths. The program should then sort the data in ascending order by base depth and display the results. Here is a sample report.

Snow Report December 12-18

Date Base
13 42.3
12 42.5
14 42.8
15 43.1
18 43.1
16 43.4
17 43.8

I don't necessarily need you guys to do all of my homework for me, but I don't understand classes very well (I understand them in structure but not in purpose or use.) So far, I've used cpluplus.com as well as the book this assignment is from to learn them to no avail. The assignment is due in like 5 hours so if someone could either teach/talk me through this assignment or write it for me and explain each component, you'd have my many thanks. I've have a test on this subject matter and so far I don't understand it at all.

##### Share on other sites
First of all, homework questions are against forum policy.

If you have homework, you probably also have an instructor. Your instructor is the natural choice for someone to help you understand the material. Chances are he is even payed for doing the work you are asking us to do.

##### Share on other sites

As a rule we don't help people with homework problems like that.

If the problem were along the lines of "I get a compiler error on line 37 and I'm not sure what the error means", that kind of problem we will generally help with.

The best thing you can do is talk with your professor or teaching assistant. The teacher needs to know that you don't understand the material so the teacher can adjust the content to you.

Even if the assignment is due in 5 hours, you can still send them an email now saying you are struggling to understand the assignment. Since it is still before the assignment is due the professor is very likely to work with you.

Consider it from the teacher's point of view. If the student doesn't ask for help and is turning in correctly completed assignments, then the teacher will assume that the student fully understands the material and should advance to the next topic.

##### Share on other sites

This topic is 2085 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

This topic is now closed to further replies.

• 18
• 29
• 11
• 21
• 16