• YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page

Has anyone started on COMP115 Assigment 1? I need help! (1 Viewer)

-=«MÄLÅÇhïtÊ»=-

Gender: MALE!!!
Joined
Jul 25, 2002
Messages
1,678
Location
On Top
Gender
Male
HSC
2002
Nino, if u miss ur prac..u get 0...(assuming ur whole class was marked..which is rare)

Here's my code from last yr..juz so u guys know how commenting should be done.


****************************************************
* Author: -= Zhaostar=- 40333337
* Date Created: 18/03/03
* Purpose: COMP 115, Sem 1, 2003, Assignment 1
* A paper size determination program for
* the Copy Shoppe
****************************************************/

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

// a function to determine paper size
int size(float, float);

int main()
{
// the input dimensions of the object
float dimension1, dimension2;

// variable x will be used later so values of dimension1
// and dimension2 can be swicthed
float x;

cin >> dimension1 >> dimension2; // do not change this line

// Write your code here
if (dimension1 > dimension2)
// switches values of dimension1 and dimension2
// avoids any confusion in defining which sides are height and width
{
x = dimension1;
dimension1 = dimension2;
dimension2 = x;
}

// variable result equals the return value from size(dimension1, dimension2)
int result = size(dimension1, dimension2);

if (result >= 0)
// for return values greater or equal to zero
{
cout << "A" << result << endl;
}
else
// for return values less than zero (ie. -1)
{
cout << "XX" << endl;
}

// PAUSE is a Dos command, so that window will not disappear
system("PAUSE");
return 0;
}//end main

int size(float h, float w)
// This function will determine the "number" size of
// a piece of paper required to copy an item of a given
// height. h. and width, w.
// Pre: h >= 0; w >= 0
// Post: -1 <= return <= 10
{
// Write your code here
// The return value will correspond to the number size of the paper
if (h <= 26 && w <= 37)
{
return 10;
}
else if (h <= 37 && w <= 52)
{
return 9;
}
else if (h <= 52 && w <= 74)
{
return 8;
}
else if (h <= 74 && w <= 105)
{
return 7;
}
else if (h <= 105 && w <= 148)
{
return 6;
}
else if (h <= 148 && w <= 210)
{
return 5;
}
else if (h <= 210 && w <= 297)
{
return 4;
}
else if (h <= 297 && w <= 420)
{
return 3;
}
else if (h <= 420 && w <= 594)
{
return 2;
}
else if (h <= 594 && w <= 841)
{
return 1;
}
else if (h <= 841 && w <= 1189)
{
return 0;
}
else if (h > 841 || w > 1189)
{
return -1;
}
} // end size
 

ND

Member
Joined
Nov 1, 2002
Messages
971
Location
Club Mac.
Gender
Male
HSC
2003
Originally posted by -=MLhtʻ=-
Nino, if u miss ur prac..u get 0...(assuming ur whole class was marked..which is rare)
Oh shit. Can't i say i was sick or something? (without a doctor's cert.)

edit: here is my code, think i'll lose too many marks?:

// the input dimensions of the plakk
float dimension1, dimension2;

int a=4*dimension1;
int f;
cout<<"Please enter the desired dimensions (width length):"<<endl;

cin>>dimension1>>dimension2; // do not change this line

if (a>dimension2)
f=a;
else f=dimension2;

if (f<=40)
cout <<"The optimum plank is P1"<<endl;
if (f>40&&f<=80)
cout <<"The optimum plank is P2"<<endl;
if (f>80&&f<=120)
cout <<"The optimum plank is P3"<<endl;
if (f>120&&f<=160)
cout <<"The optimum plank is P4"<<endl;
if (f>160&&f<=200)
cout <<"The optimum plank is P5"<<endl;
if (f>200)
cout <<"Not in stock"<<endl;
 

bong

Member
Joined
Jun 11, 2003
Messages
433
Gender
Male
HSC
2003
computer marking wont accept "the optimum plank is p..."

nor the user prompt

faq page on comp115 site
 

boinkBOINK

hustler
Joined
Feb 5, 2003
Messages
862
Gender
Undisclosed
HSC
N/A
u werent supposed to have the extra stuff in ur code or it doesnt get marked as bong said~
jus take a look at mine

but hmmmm! seems as though! lol the assignemnts are similiar each yr!
anyone wanna send me their 2nd assignment from last yr
lol
 

bong

Member
Joined
Jun 11, 2003
Messages
433
Gender
Male
HSC
2003
mine is similar to boinkboink's lol, might post it after its marked

Originally posted by boinkBOINK
but hmmmm! seems as though! lol the assignemnts are similiar each yr!
anyone wanna send me their 2nd assignment from last yr
lol
:D :D :D
 

boinkBOINK

hustler
Joined
Feb 5, 2003
Messages
862
Gender
Undisclosed
HSC
N/A
hayy!~
lol i shoulda posted after
if someoen got it wrong they coulda still used mine
but well lose 20% but still! better than 0

*runs back to edit post
 

ND

Member
Joined
Nov 1, 2002
Messages
971
Location
Club Mac.
Gender
Male
HSC
2003
Fuck, did it say that we were only supposed to put "Pn"? i've gotta read these things...
 

boinkBOINK

hustler
Joined
Feb 5, 2003
Messages
862
Gender
Undisclosed
HSC
N/A
accordin to the sheet u get marks on
readability - varnames identation
documentation - useful comments
elegance ofcode - smal lfunctions simple logic no redundant code
nd bonus ques
 

bong

Member
Joined
Jun 11, 2003
Messages
433
Gender
Male
HSC
2003
Originally posted by Orange Juice
wait were we MEANT to comment? cuz at no where does it say to comment
Originally posted by ND
Fuck, did it say that we were only supposed to put "Pn"? i've gotta read these things...
u guys gotta read the faqs page more :D
 

...

^___^
Joined
May 21, 2003
Messages
7,723
Location
somewhere inside E6A
Gender
Male
HSC
1998
Originally posted by Orange Juice
wait were we MEANT to comment? cuz at no where does it say to comment
u need to comment

theres no marking criteria...so wtf

u dun have to comment every line
just a few will do...

and yea, ND, u r not suppose to have "plank size is blah"

only "P1" or "Px"
 

ND

Member
Joined
Nov 1, 2002
Messages
971
Location
Club Mac.
Gender
Male
HSC
2003
Well what happens if i reupload it now, with everything fixed? Will i get full marks minus the 20%? That would still be better than what i'll get otherwise...
 

Orange Juice

so worthless i am
Joined
Nov 23, 2002
Messages
3,886
Location
Room 112
Gender
Male
HSC
2007
Originally posted by ND
Well what happens if i reupload it now, with everything fixed? Will i get full marks minus the 20%? That would still be better than what i'll get otherwise...
i was thinking the same... by adding comments...decisions decision!
 

...

^___^
Joined
May 21, 2003
Messages
7,723
Location
somewhere inside E6A
Gender
Male
HSC
1998
Originally posted by ND
Well what happens if i reupload it now, with everything fixed? Will i get full marks minus the 20%? That would still be better than what i'll get otherwise...
penalty..
 

bong

Member
Joined
Jun 11, 2003
Messages
433
Gender
Male
HSC
2003
keep in mind the bonus q

u can get max of 5% for assignment 1
 

-=«MÄLÅÇhïtÊ»=-

Gender: MALE!!!
Joined
Jul 25, 2002
Messages
1,678
Location
On Top
Gender
Male
HSC
2002
im not sur eif commenting is that important in this assignment, coz all u have is if statements and a variable changing fn. coding becomes more hardcore later on and u'll need commenting. u might get away with it this time if its obvious enuff
 

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

Top