HardwareHeaven.com

HardwareHeaven.com

Looking for the skin chooser?
 
 
  • Home

  • Hardware reviews

  • Articles

  • News

  • Tools

  • Gaming at HardwareHeaven

  • Forums

 

Go Back   HardwareHeaven.com > Forums > Software / Tools > Programming, Coding, (Web)Design


Programming, Coding, (Web)Design Discuss all your programming or design needs with likeminded people.

Reply
 
Thread Tools
Old Sep 2, 2004, 03:26 AM   #1
Delete Me
 
Join Date: Mar 2004
Posts: 14,648
Rep Power: 0
pr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to all

i have the world's easiest CS class

it's official...i have the world's easiest CS class ever. it's java based, btw...but here is our 'project', including the 'harder' option and the extra credit

Code:
 import cs1.Keyboard;
 import java.text.DecimalFormat;
 
 public class Project1
 
 
 
 {
 
 	public static void main (String[] args)
 
 	{
 
 		final int speed = 2;
 
 		int yl, yw, hl, hw, ya, ha, ga;
 		float ttms, ttmm;
 
 		System.out.println ("Enter the length of the yard:");
 
 		yl = Keyboard.readInt();
 
 		System.out.println ("Enter the width of the yard:");
 
 		yw = Keyboard.readInt();
 		System.out.println ("Enter the length of the house:");
 
 		hl = Keyboard.readInt();
 		System.out.println ("Enter the width of the house:");
 
 		hw = Keyboard.readInt();
 		ha = hl*hw; //house area
 		ya = yl*yw; //yard area
 		ga = ya-ha; //grass area
 		ttms = ga/speed; //time to mow in seconds
 		ttmm = ttms/60; //time to mow in minutes
 		DecimalFormat threeDecPlcFormatter = new DecimalFormat("0.000");
 		System.out.println("The house dimensions were: " + hl + "x" + hw + " for an area of " + ha + " square feet.");
 		System.out.println("The yard dimensions were: " + yl + "x" + yw + " for an area of " + ya + " square feet.");
 		System.out.println("The area covered by grass is :" + ga + " square feet.");
 		System.out.println("It would take " + ttmm + " minutes to mow.");
 		System.out.println("Or, taken to 3 decimal places " + threeDecPlcFormatter.format(ttmm) + " minutes to mow.");
 	}
 }
pr0digal jenius is offline   Reply With Quote


Old Sep 2, 2004, 06:29 AM   #2
confutatis maledictis
 
Vampyromaniac's Avatar
 
Join Date: May 2002
Location: somewhere dark
Posts: 5,974
Rep Power: 77
Vampyromaniac is just really niceVampyromaniac is just really niceVampyromaniac is just really niceVampyromaniac is just really niceVampyromaniac is just really nice
System Specs

yeah that is simple, did you just start? and is it the first class in CS? I think it gets harder later
__________________
Digitalis 3.3
Athlon 64 3000 // ASUS K8V SE Deluxe // 1024MB PC3200 (2-2-2-10 1T)
ATI All-In-Wonder 9700 Pro // 20" Dell 2005FPW (DVI)
M-Audio Revo 7.1 + Philips Acoustic Edge // Klipsch ProMedia 2.1
320/16 Western Digital WD3200KS + 120/8 Seagate 7200.7
NEC ND-3550A 16x DVD±RW + Lite-On 52x24x CD-RW
Antec Sonata case // 480W Antec TruePower

personal bests || Aq'3: 46796 | 3D'01: 20461 | 3D'03: 6336 | 3D'05: 2677 | PC'04: 4605 | PC'02: 7691,9092,1250

Vampyromaniac is offline   Reply With Quote
Old Sep 2, 2004, 07:12 AM Threadstarter Thread Starter   #3
Delete Me
 
Join Date: Mar 2004
Posts: 14,648
Rep Power: 0
pr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to all

no, supposedly this is the 2nd...i skipped the 1st one

and the rest of my class is kinda dim at times...like not knowing how to login to windows 2000
pr0digal jenius is offline   Reply With Quote
Old Sep 2, 2004, 04:09 PM   #4
BSD SMASH!
 
Malus's Avatar
 
Join Date: May 2002
Location: A rabbit hole. . .
Posts: 1,170
Rep Power: 0
Malus is on a distinguished road

It better get harder.

So far, I hsven't done a vast array of cool stuff in college, but I have written an AI for Scrabble (in Java), a few different solutions to the satisfiability problem, including WalkSAT, and a CMS in PHP/MySQL.

You usually don't do the cool stuff until you take restricted electives or upper level courses.
__________________
quad (FreeBSD/amd64 8-CURRENT): Intel Q6600 - Asus P5E-VM HDMI - 2x2 GB Kingston PC6400 DDR2 Ram - Seagate 320GB 7200RPM HD - 2xSeagate 1TB 7200RPM HD in RAID 1 via ZFS - Lite-On 20x DVD Multi Recorder - Coolermaster Centurion 5

router (FreeBSD/amd64 8-CURRENT):
Intel E4500 - Intel D945GCNL - 2 GB PC6400 Mushkin Ram - Lite-On 48x24x48x16 - Seagate 320GB 7200RPM HD - Silverstone SST-SG02-F

wanderer (FreeBSD/i386 7-CURRENT): Lenovo Thinkpad T61p

mini (OS X 10.5): Intel Core 2 Duo @ 1.8Ghz, 4 GB Mushkin PC5400 Ram -
Headroom MicroDAC

Portable sound: Rockboxed iPod Video -> Westone UM2's
Not-So-Portable Sound: Headroon MicroDAC -> Singlepower PPX3-SLAM -> Grado RS-1's or Beyerdynamic DT-880's
Very-Not-Portable-Sound: Squeezebox v3 -> Denon AVR-1507 -> B&W 683's & Sunfire HRS-10
Malus is offline   Reply With Quote
Old Sep 2, 2004, 07:04 PM Threadstarter Thread Starter   #5
Delete Me
 
Join Date: Mar 2004
Posts: 14,648
Rep Power: 0
pr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to all

yea...it'll get lots harder come next year anbd the year after...i just want it to get harder faster b4 i fall asleep
pr0digal jenius is offline   Reply With Quote
Old Sep 2, 2004, 10:17 PM   #6
HH Administrator
 
craig5320's Avatar
 
Join Date: May 2002
Location: Manchester, UK
Posts: 8,572
Rep Power: 445
craig5320 is godlike in his statuscraig5320 is godlike in his statuscraig5320 is godlike in his statuscraig5320 is godlike in his statuscraig5320 is godlike in his statuscraig5320 is godlike in his statuscraig5320 is godlike in his statuscraig5320 is godlike in his statuscraig5320 is godlike in his statuscraig5320 is godlike in his statuscraig5320 is godlike in his status
System Specs

Yea I had that in a module last year, teaching us html, I'm not even talking XHTML or remotely complicated. table's were the most complicated tag we hit, pity I learned html bout 6 years ago
__________________

HardwareHeaven on Facebook
craig5320 is offline   Reply With Quote
Old Sep 2, 2004, 11:50 PM Threadstarter Thread Starter   #7
Delete Me
 
Join Date: Mar 2004
Posts: 14,648
Rep Power: 0
pr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to all

yea, i learned a good bit of java about 2-3 years ago..so this is sad and pathetic...lol
pr0digal jenius is offline   Reply With Quote
Old Feb 15, 2005, 06:13 AM   #8
Forged on Dragonmount
 
Callandor's Avatar
 
Join Date: Oct 2004
Location: Saskatoon, Saskatchewan, Canada
Posts: 7,244
Rep Power: 304
Callandor is godlike in his statusCallandor is godlike in his statusCallandor is godlike in his statusCallandor is godlike in his statusCallandor is godlike in his statusCallandor is godlike in his statusCallandor is godlike in his statusCallandor is godlike in his statusCallandor is godlike in his statusCallandor is godlike in his statusCallandor is godlike in his status
System Specs

Donator Gold Member
I feel sorry for you pj, LOL, but then again, I'll be in the same boat as well next year.
__________________
Callandor is online now   Reply With Quote
Old Feb 15, 2005, 09:51 AM   #9
md5
DriverHeaven Senior Member
 
md5's Avatar
 
Join Date: Dec 2004
Location: Inside DriverHeaven
Posts: 856
Rep Power: 0
md5 has a spectacular aura aboutmd5 has a spectacular aura about

*sigh* reminds me of my first semester in CS... everything was much simpler then
__________________
md5 is offline   Reply With Quote
Old Feb 15, 2005, 09:17 PM Threadstarter Thread Starter   #10
Delete Me
 
Join Date: Mar 2004
Posts: 14,648
Rep Power: 0
pr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to all

it's gotten a LITTLE harder now(new semester)...but the hardest thign we've hit yet is a very little bit of inheritance, such as using the 'super' / 'extends' command
pr0digal jenius is offline   Reply With Quote
Old Feb 15, 2005, 09:39 PM   #11
I Have lovely Breasts
 
Geminiwave's Avatar
 
Join Date: Jul 2004
Location: In the closet...
Posts: 5,395
Rep Power: 64
Geminiwave is a glorious beacon of lightGeminiwave is a glorious beacon of lightGeminiwave is a glorious beacon of lightGeminiwave is a glorious beacon of lightGeminiwave is a glorious beacon of lightGeminiwave is a glorious beacon of light

dude when I read the topic title I thought "They offer Counter-Strike classes?! what?! SIGN ME UP!!!"
__________________
Geminiwave is offline   Reply With Quote
Old Feb 16, 2005, 06:18 PM   #12
DriverHeaven Junior Member
 
Join Date: Jul 2002
Location: Derby UK
Posts: 78
Rep Power: 0
StuRReaL is on a distinguished road

Quote:
Originally Posted by pr0digal jenius
it's gotten a LITTLE harder now(new semester)...but the hardest thign we've hit yet is a very little bit of inheritance, such as using the 'super' / 'extends' command
oooo you're in for a treat next then, if you want hard then have a look at polymorphism assuming you don't know about it already but if you find it easy then surely thats a good thing it means you'll pass really easily with A+ all the way
__________________
AMD Athlon64 X2 4200+
1GB OCZ Platinum
x2 74Gb WD Raptors RAID0
256mb Radeon X1300
Sapphire Pure Innovation
M-Audio Revolution 7.1
Windows XP x64 Edition
StuRReaL is offline   Reply With Quote
Old Feb 18, 2005, 05:31 PM   #13
Anti-Piracy Poster Boy
 
YAYitsAndrew's Avatar
 
Join Date: Oct 2004
Location: NJ
Posts: 2,605
Rep Power: 79
YAYitsAndrew has a divinity and aura the likes we have never seenYAYitsAndrew has a divinity and aura the likes we have never seenYAYitsAndrew has a divinity and aura the likes we have never seenYAYitsAndrew has a divinity and aura the likes we have never seenYAYitsAndrew has a divinity and aura the likes we have never seenYAYitsAndrew has a divinity and aura the likes we have never seenYAYitsAndrew has a divinity and aura the likes we have never seenYAYitsAndrew has a divinity and aura the likes we have never seenYAYitsAndrew has a divinity and aura the likes we have never seenYAYitsAndrew has a divinity and aura the likes we have never seenYAYitsAndrew has a divinity and aura the likes we have never seen
System Specs

Polymorphism is nothing. Just wait until you're writing your own compiler for a small subset of the pascal language. And it's 80% of your grade.
__________________
"It is because the resistance to paying for copyrighted material, although often characterized as arising from a supposed technical burden or principled concern for the public interest, arises rather from exactly the same segment of the brain that is dominant in shoplifters."
- Mark Helprin, Digital Barbarism

In other words, it's never okay to steal even if you think you have a good reason!

www.yayitsandrew.com
YAYitsAndrew is offline   Reply With Quote
Old Feb 18, 2005, 05:39 PM Threadstarter Thread Starter   #14
Delete Me
 
Join Date: Mar 2004
Posts: 14,648
Rep Power: 0
pr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to allpr0digal jenius is a name known to all

lol...we're not quite to polymorphism yet...that comes in a few weeks
pr0digal jenius is offline   Reply With Quote
Old Feb 19, 2005, 11:23 AM   #15
DriverHeaven Junior Member
 
Join Date: Jul 2002
Location: Derby UK
Posts: 78
Rep Power: 0
StuRReaL is on a distinguished road

Quote:
Originally Posted by YAYitsAndrew
Polymorphism is nothing. Just wait until you're writing your own compiler for a small subset of the pascal language. And it's 80% of your grade.
Yeah ok thats hard, thats not something i'd ever consider doing, for fun or for a module on course
__________________
AMD Athlon64 X2 4200+
1GB OCZ Platinum
x2 74Gb WD Raptors RAID0
256mb Radeon X1300
Sapphire Pure Innovation
M-Audio Revolution 7.1
Windows XP x64 Edition
StuRReaL is offline   Reply With Quote
Old Apr 27, 2005, 12:22 PM   #16
DriverHeaven Newbie
 
Join Date: Apr 2005
Location: Salem
Posts: 6
Rep Power: 0
Jon855 is on a distinguished road

exclamation Easy but...

I'm in CS at RIT and this coding will give you an F due to lack of comments. In my CS courses, every thing you do even the "hello world" requires you to comment in. But regardless are you sure you're taking the general CS, well what college are you in? I'm just wondering only because you said that you've skipped the basics and I'm telling you, your code ARE BASIC. I could post in one of my code and FYI, this is from the beginner course of Java Programming. There are two different files and I am not perfect and the code is not perfect but I would say 90% correct in most case, the only thing wrong with it is the ranking system.
Code:
//Purpose: 	Homework #7
//Coder:	XXXXXXXX XXXXX
//Professor:	Mr.French
//Date:		02-07-2005

//imprting a file
import javax.swing.*;

public class TestQuarterback
{
	public static void main(String[] args)
	{


		//New Object of QuARTERBACK CLASS
		Quarterback run = new Quarterback();
		run(run);

	}

	public static void run(Quarterback run) {
		//Menu Variable
	int menuChoice = 0; 		//Variable that determines which aspect of program to execute...

		//Run Menu Choice
		menuChoice = MyInputPane.readInt("Options:"
		+ "\n1.Update Quarterback statistics"
		+ "\n2.Print Average Pass Yardage"
		+ "\n3.Print Completed Passes Percentage"
		+ "\n4.Print Touchdown Passes Percentage"
		+ "\n5.Print Intercepted Passes Percentage"
		+ "\n6.Print Quarterback Rating"
		+ "\n7.Print Current Statistics"
		+ "\n8.Exit Program \nEnter Options:");



		//Validatining MenuChoice
		while (!(menuChoice > 0 && menuChoice < 9))
		{
			//runs menu choice again
			MyInputPane.displayMessage("An Invalid Value Entered");
			menuChoice = MyInputPane.readInt("ERROR, ENTER 1-8 ONLY"
			+	"\n Options: "
			+	"\n1.Update Quarterback statistics "
			+	"\n2.Print Average Pass Yardage "
			+	"\n3.Print Completed Passes Percentage "
			+	"\n4.Print Touchdown Passes Percentage "
			+	"\n5.Print Intercepted Passes Percentage "
			+	"\n6.Print Quarterback Rating "
			+	"\n7.Print Current Statistics "
			+	"\n8.Exit Program "
			+	"\nEnter Options:");
		}//ends while validatining menuChoice

		//while loop runs switch loop until 8 is entered then it kills program and exit
		while(menuChoice != 8)
		{
			//switch loop decides which aspect of program to execute
			switch (menuChoice)
			{

			case 1: while (!run.setPassAttempt(MyInputPane.readDouble("Year to date:\n Number of passing attempts")))
					  {}
		 		while (!run.setCompletedPass(MyInputPane.readInt("Number of Complete Pass")))
					 {}
		 		while (!run.setTotalPassYard(MyInputPane.readInt("Pass Yardage")))
					 {}
		 		while (!run.setTouchdownPass(MyInputPane.readInt("Number of Touchdown Pass")))
					 {}
		 		while (!run.setPassInt(MyInputPane.readInt("Number of Pass Intercepted")))
					 {}
					run(run);
					//Run Menu Choice
				break;

			case 2: MyInputPane.displayMessage("Average Passing Yardage : " + (run.getTotalPassYard() / run.getCompletedPass()));
					run(run);
					//Run Menu Choice
				break;

			case 3:MyInputPane.displayMessage("Completed Passing Percentage : " + (run.getCompletedPass() / run.getPassAttempt()));
					run(run);
					//Run Menu Choice
				break;

			case 4:MyInputPane.displayMessage("Touchdown Pass Percentage : " + (run.getTouchdownPass() / run.getPassAttempt()));
					run(run);
					//Run Menu Choice
				break;

			case 5:MyInputPane.displayMessage("Intercepted Pass Percentage : " + (run.getPassInt() / run.getPassAttempt()));
					run(run);
					//Run Menu Choice
				break;

			case 6:MyInputPane.displayMessage("Quarterback Rating : " + (((((run.getCompletedPass() / run.getPassAttempt())) * .05)+(((run.getTotalPassYard() / run.getPassAttempt())-3)* .25)+((run.getTouchdownPass() / run.getPassAttempt())* .2)+(((run.getPassInt() / run.getPassAttempt())*.25)- 2.375)/10)*100));
					run(run);
					//Run Menu Choice
				break;

			case 7:MyInputPane.displayMessage("Current Quarterback Statistic:"
		 	+	"\nQuarterback Pass Attempts : " + run.getPassAttempt()
	 		 +	"\nQuarterback Pass Completed : " + run.getCompletedPass()
	 		 +	"\nTotal Yard Passed : " + run.getTotalPassYard()
		 	+	"\nCompleted Touchdown Passes : " + run.getTouchdownPass()
	 		 +	"\nTotal Pass Intercepted : " + run.getPassInt());

					run(run);
					//Run Menu Choice
				break;

				case  8: System.exit(0);
				break;


			}//ends switch loop
		}//Ends while loop

		System.exit(0);
		//Exits the program...

	}//Ends main method
}//Ends class file
And here is the other file required to make the top code work.
Code:
//Purpose: 	Homework #7
//Coder:	XXXXXXXX XXXXX
//Professor:	Mr.French
//Date:		02-07-2005

public class Quarterback
{
	//Attributes are private
private double numPassAttempt;	 			//Number of Pass Attempt
	private double cmplPass;		 			//Completed Pass
	private double totalYard; 		 		//Total Passing Yardage
private double touchdownPass;	 			//Touchdown Pass
	private double passInt; 		 			//Number of Pass Intercepted

	//default constructor
	public Quarterback()
	{
		numPassAttempt = 0;
		cmplPass = 0;
		totalYard = 0;
		touchdownPass = 0;
		passInt = 0;
	}


	// --------------------------- //
	//All Accessors Are Listed Here
	// --------------------------- //

	//Number of Pass Attempt
	public double getPassAttempt()
	{
		return numPassAttempt;
	}

	//Number of Completed Pass
	public double getCompletedPass()
	{
		return cmplPass;
	}

	//Total Pass Yardage
	public double getTotalPassYard()
	{
		return totalYard;
	}

	//Number of Touchdown Passes
	public double getTouchdownPass()
	{
		return touchdownPass;
	}

	//Number of Pass Intercepted
	public double getPassInt()
	{
		return passInt;
	}

	//All Mutators Are Listed Here
	// ------------------------- //

	//Number of Pass Attempts
	public boolean setPassAttempt(double passAttempt)
	{
		if (passAttempt >= 0)
		{
			numPassAttempt = passAttempt;
			return true;
		}
		return false;
	}

	//Number of pass completed
	public boolean setCompletedPass(int complPass)
	{
		if (cmplPass >= 0)
		{
			cmplPass = complPass;
			return true;
		}
		return false;
	}

	//Pass Yardage
		public boolean setTotalPassYard(int totalYardage)
		{
			if (totalYardage >= 0)
			{
				totalYard = totalYardage;
				return true;
			}
			return false;
	}

	//Number of Touchdown Pass
		public boolean setTouchdownPass(int tdPass)
		{
			if (tdPass >= 0)
			{
				touchdownPass = tdPass;
				return true;
			}
			return false;
	}

	//Number of Pass Intercepted
		public boolean setPassInt(int intPass)
		{
			if (intPass >= 0)
			{
				passInt = intPass;
				return true;
			}
			return false;
	}


	/**
	formula for qb ranking

	subtract 30 from qb passsing ranking then multiply by .05
	subtract 3 from qb yards per attempt and multiply by .25
	divide qb number of touchdown passes by his number of passing attempts
	multiplly percentage of touch down passes per attempt by .2
	multiply his interception percentage by .25
	add final 4 numbers in each category
	divide by 10 then multiply by 100 [yeilds qb rating]
	*/

}
I hope this will give you an insight of my beginner's course. While the whole coding of mine is rather on a beginner level but the concept of using accessors and mutators were a bit tedious for me. I am not a genius on this but I think this should give you an insight of what to expect in the beginner course of mine. I just hope your course will get harder over the time since you skipped the basics. I sure hope your professor's not a wacko like --> or of any that sort. Java's fun and nice. I wish you the uttermost luck in the course. Oh on a side note I recieved a C grade for this homework only due to two things, not enough of comments and the ranking system is not correct.

Last edited by Jon855; Apr 27, 2005 at 01:26 PM.
Jon855 is offline   Reply With Quote
Old May 7, 2005, 11:19 PM   #17
BSD SMASH!
 
Malus's Avatar
 
Join Date: May 2002
Location: A rabbit hole. . .
Posts: 1,170
Rep Power: 0
Malus is on a distinguished road

Quote:
Originally Posted by StuRReaL
Yeah ok thats hard, thats not something i'd ever consider doing, for fun or for a module on course
It's not too bad if you are using lex/yacc. Using those tools, its pretty simple to make a compiler or an interpreter. It only takes a few minutes to make a simple calculator too.
__________________
quad (FreeBSD/amd64 8-CURRENT): Intel Q6600 - Asus P5E-VM HDMI - 2x2 GB Kingston PC6400 DDR2 Ram - Seagate 320GB 7200RPM HD - 2xSeagate 1TB 7200RPM HD in RAID 1 via ZFS - Lite-On 20x DVD Multi Recorder - Coolermaster Centurion 5

router (FreeBSD/amd64 8-CURRENT):
Intel E4500 - Intel D945GCNL - 2 GB PC6400 Mushkin Ram - Lite-On 48x24x48x16 - Seagate 320GB 7200RPM HD - Silverstone SST-SG02-F

wanderer (FreeBSD/i386 7-CURRENT): Lenovo Thinkpad T61p

mini (OS X 10.5): Intel Core 2 Duo @ 1.8Ghz, 4 GB Mushkin PC5400 Ram -
Headroom MicroDAC

Portable sound: Rockboxed iPod Video -> Westone UM2's
Not-So-Portable Sound: Headroon MicroDAC -> Singlepower PPX3-SLAM -> Grado RS-1's or Beyerdynamic DT-880's
Very-Not-Portable-Sound: Squeezebox v3 -> Denon AVR-1507 -> B&W 683's & Sunfire HRS-10
Malus is offline   Reply With Quote
Reply

Thread Tools