Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Rebel Coder

Member Since 01 Mar 2012
Offline Last Active Nov 22 2014 03:26 PM

Topics I've Started

Plane Assignment Program From Hell For A Very Bad Java Programmer

10 December 2012 - 07:04 PM

Problem:
-Create a java program in which an airline can keep track of it's seating assignments.
-Using the InputDialog Method ask the user how many people will be coming aboard the plane.
- The plane consists of only 5 seats.
- Keep assigning people to the seats in the plane until all seats are filled.
-Once every seat is filled tell the user no more seats are avaiable.

Question:
Ok I have a simple question. How do I make it so that I can read the elements inside an array and if any one of them gets to or above 5 it stops letting me input numbers. For example, let's say I have 2 in index 0 and 3 in index 1, that makes 5 so I don't want to store anything more and when i go and input another number it doesn't let me. Another example, let's say index 0 holds the number 5 then it won't let me progress to index 1 because I already have the desired number which is 5. I hope that was pretty clear. This is for a plane assignment seating program with only 5 seats. This is what I have so far:


[source lang="java"]import javax.swing.JOptionPane;public class Seating { public static void main(String args[]) { int seatstaken = 0; int seats[] = new int [5]; do{ JOptionPane.showMessageDialog(null, "Welcome to Coqui Air!"); for ( int i= 0; i < seats.length; i ++){ seats[i] = Integer.parseInt(JOptionPane.showInputDialog("How many people will be traveling with you today?")); } for (int i = 0; i <seats.length; i++){ seatstaken += seats[i]; } }while(seatstaken <5); if (seatstaken > 5){ JOptionPane.showMessageDialog(null, "Plane full."); } } }[/source]




It's pretty terrible code, but I'm a beggining java programmer and my proffessor did not explain this subject of arrays at all, he just gave us a very brief example and it did not clear up my doubts whatsoever. Also in his example he uses a scanner for input, the problem requires that we use the JOptionPane user input method. Any help is appreciated as I have been trying to solve this since 4 pm my time.

Save my life from miserable hours of manual labor xD

22 October 2012 - 03:17 PM

So guys, being the awesome community that you are I came to ask for help with a little problem. See I have to make some cards for my college precinct for the night of honors yada yada, basically an activity. Now I have the list of people and its about 800 people D:, gotta get this done by wednesday. So here's what I've been doing, I created my labels, got them all set up real sexy like :P and I've been manually inserting each person into the label and let's say it's going very,........ slow. So what I want to know (because yes I do not know how) is if I can grab lets say 20 people from the rows of my table and then copy them and paste them into my labels document all at the same time and it will just create new labels for me as the need arises, instead of me having to copy one then paste one into the label and so on, and when my labels run out, copy and paste those again. I hope I explained what I want to do right , I just don't wanna spend hours on this because I'll die haha, if this can be done please let me know. If not I will see you at my funeral after I am done xD

ASP.NET with VB. I need help

26 September 2012 - 06:17 PM

So my teacher gave us this awesome project where we have to data bind the information the user enters on a textbox and selects on a drop down list at the click of a button. He gave us this video which showed us how to get the database set up with the table easy peasy, then when it came to the button coding part, the guy in the video was using C# and I need to do it in VB -___-, I've been looking around and no one can give me a clear answer. So how do I make it so when I click the button it saves the info on a textbox to my table and a dropdownlist selection. If anyone can tell me I'd really appreciate it.

It finally happened

12 July 2012 - 10:57 PM

That wonderful, wonderful spark that you get when it finally clicks for you. Here's my story: I'm a college student going into his second year of Computer Science, I've programmed in Visual Basic and C++. My experience with both was ok, Visual Basic just doesn't do it for me although I know for alot of people here it's a great language but I find it, boring?. C++ is a great language, very fun to work with but tedious although not as hard to grasp as some say, it does have it's steep learning curve though. Now I love programming dont get me wrong but I spent and entire year making forms on Visual Basic and console applications on C++ now it's awesome to see your screen show what you asked it to do and everything I mean the first time I wrote "Hello world!" on a screen through programming I was like a toddler with a new toy all excited Posted Image. But they didn't give me that spark I don't know how to explain it.

See my desire is to become the owner of my own game studio one day ( big aspiration but it will happen!, even my girlfriend believes it will happen and her word is law so yea it will happen lol), back to the original topic lol. Anyways when I programmed those console apps and forms I was like "This is cool but not that wow".So I decided to start doing my own research in the programming world. Introduce the greatest C# book I have ever read( In my personal opinion not saying it is lol): Introduction to Programming Through Game development Using Microsoft XNA Studio, by Rob Miles( this dude is awesome!!!). Now the book is a bit dated but everything in it works just fine with XNA 4.0 (at least so far and I'm at page 156 or so). This book gave me that spark to just want to devour programming like anutcase, when I made my first game which was a simple moodlight and it changed colors on its own I was like oooh awesome, now when I made it so that I could change the color of the light with the xbox controller, one word my friend, EPIC lol. It is a silly game as he says but when you see those results you fall in love and they are fun results indeed.

He explains everything in a clear manner unlike my ahem "instructors" and even his jokes are fun to read. When you see your silly games running you cant help but be excited. So now I have that spark to know more and more, I've been learning everything I can about C# and I have to say, much easier than C++ and much more fun than VB. Also XNA is a really great framework, speeds up the development process by alot and it's easy to understand, I just hope with the release of metro windows 8 it doesn't get the short end of the stick. Honestly I just wanted to say that I now have that spark that I needed and I know most of you will read this and say "this guy is crazy" but hey I got it off my chest so I'm happy and am well on my way to creating my first "complete" crappy game lol

PARTNERS