Subscribe to dasrhino's Blog        RSS Feed
-----

Blog Post Number 1

Icon 4 Comments
So I realize that I probably won't have very many people read this but though it would be important to document my progress now that I am finally getting to start my programming classes for school. Super excited that i get to start them but not to sure about the whole java thing. As I want to one day work on game engines I fear that it would be much better to start off in C++ but just don't have the time to learn a second language along with everything else i have going on. The important thing is that I learn to think like a programmer from what I hear. Anyhow if anyone out there happens to stumble across this blog here is one of my first programs I made from scratch after 4 weeks of school. There are a number of things I want to do to this but what the hell enjoy it world one day this little puppy is going to be worth money. But i think i won't quit my day job quite yet. Any thoughts or advice out there much appreciated! For now I am just going to keep on trucking through this book.

-dasrhino

import java.util.Scanner;

public class BankAccount
{
	public static void main (String[] args)
	
	{ // prompt user to start the system by pressing 1 if user does not enter 1 then atm will turn off and spit out card
		System.out.print("\nEnter 1 to start system:");
		Scanner input = new Scanner( System.in );
		int startSystem = input.nextInt();
		while( startSystem == 1) // start loop that will allow user to enter or remove funds
		{
		
		//assign the account number and password needed to login to the system
		int accountNumber = 123456;
		int password = 654321;
		float balance = 100;
		
		//prompt user to enter an integer and compare it to the account number on file 123456
		System.out.println ("\n\nPlease enter your account number:"); 
		int myAccountNumber = input.nextInt();
		
		//prompt user to enter an integer and compare it to the password on file 654321
		System.out.println ("\nPlease enter your password:");
		int myAccountPassword = input.nextInt();
		
		// compares the user entered password to that which is on file and if a math grants access to a transaction
		if ( myAccountNumber == accountNumber && myAccountPassword == password )
		{
			// welcome user, display balance, and prompt whether to withdraw or deposit
			System.out.println("\nWelcome to Woody's bank!");
			System.out.printf("\nYour account balance is:$%.2f\n", balance);
			System.out.println("\nWould you like to deposit or withdraw funds?");
			
			String myAction = input.next();
			
			//compare the user entered string and if it is withdraw then prompt user to enter in a withdraw amount and display new balance
			if (myAction.equals("withdraw"))
				{ 
				System.out.println("\nHow much?");
				float withdrawAmount = input.nextFloat();
				balance = balance - withdrawAmount;
				System.out.printf("\nYour balance is now:$%.2f", balance);
				}
				
			//compare the user entered string and if it is deposit then prompt user to enter in a deposit amount and display new balance
			if (myAction.equals("deposit"))
				{
				System.out.println("\nHow much?");
				float depositAmount = input.nextFloat();
				balance = balance + depositAmount;
				System.out.printf("\nYour balance is now:$%.2f\n", balance);
				}
		}
		
		// ask for the uer to start a new transaction or end by comparing a value to 1
		System.out.print("\n\nPress 1 to start a new transaction or press 2 to eject card:");
		int startSystem2 = input.nextInt();
		
		if(startSystem2 != 1)
		break;
		}
		System.out.print("\nThank you for your business please take your card.");
	}
}


4 Comments On This Entry

Page 1 of 1

fromTheSprawl Icon

27 September 2012 - 06:18 PM
Can you choose what programming classes you'll take? You say that you've just started them, so I guess you're in a set curriculum. What I suggest is learn everything you can with Java, since most of the concepts there you would easily be able to use on C++ such as object oriented programming and maybe threads, both important concepts in game programming. You'll find out that most of the time, the syntax will be the huge difference between the languages but most of the core concepts will still stay the same. A good programmer never stays on one language, he/she tries out everything that is out there too. Well, that's what I think anyway. Good luck.
0

dasrhino Icon

27 September 2012 - 10:21 PM

fromTheSprawl, on 27 September 2012 - 06:18 PM, said:

Can you choose what programming classes you'll take? You say that you've just started them, so I guess you're in a set curriculum. What I suggest is learn everything you can with Java, since most of the concepts there you would easily be able to use on C++ such as object oriented programming and maybe threads, both important concepts in game programming. You'll find out that most of the time, the syntax will be the huge difference between the languages but most of the core concepts will still stay the same. A good programmer never stays on one language, he/she tries out everything that is out there too. Well, that's what I think anyway. Good luck.


Thanks for the feedback! I have to take my first two classes in java at the local community college. After that its on to the University of Utah to be in their EAE program. They do the same thing with java being your prerequisite. I have decided to read a second java book at the same time as the one for our class to have a second perspective on the whole thing. It really helps to fill in the blanks when one book doesn't quite cut it. I just wish I did not have to spend so much damn time doing calculus homework. Lol. I spent time as a tech recruiter in a past life and every time I placed a guy in the gaming industry it seemed like they cared more about his design skills than the actual coding. I didn't know half of what i do know though so i could just have been clueless. I must expand my knowledge twice every single day! Curious if you have any recommendations for a good C++ book to start on after I finish these Java ones...? anyhow thanks for the input!
0

fromTheSprawl Icon

27 September 2012 - 10:33 PM
Oh, so your main target is game programming? Well, I've only tried C++ ones and I remember I got a book back then from this thread: http://www.dreaminco...first-to-begin/
0

dasrhino Icon

27 September 2012 - 10:49 PM

fromTheSprawl, on 27 September 2012 - 10:33 PM, said:

Oh, so your main target is game programming? Well, I've only tried C++ ones and I remember I got a book back then from this thread: http://www.dreaminco...first-to-begin/


My hats off to you thanks!
0
Page 1 of 1

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

July 2014

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
27 28 293031  

Tags

    Recent Entries

    Recent Comments

    Search My Blog

    1 user(s) viewing

    1 Guests
    0 member(s)
    0 anonymous member(s)

    Categories