thrihyrne: Portland, OR (Starbuck by vilkibot)
[personal profile] thrihyrne
I wanted to weep. This is my first programming assignment. Cut because it's just code, and not even beautiful code at that, but it was the mathematics that made me want to tear out my hair.


import java.util.Scanner;
/**************************************
* Programming Assignment 1
*
* @author - Kristi Lee
* @version - V1 - 09//2010
*************************************/

/*************************************
* References and Acknowledgements:
*
*************************************/

public class ChangeMaker
{
/********************************************
* Change Maker is a program that converts an
* integer to the number of dollars, quarters,
* dimes, nickels and pennies.
********************************************/
public static void main (String args [])
{

// declarations
int input;
int dollar;
int modulusdollar;
int quarter;
int modulusquarter;
int dime;
int modulusdime;
int nickel;
int modulusnickel;
int penny;
int moduluspenny;



Scanner keyboard;

// input the seconds
keyboard = new Scanner(System.in);

System.out.print("Welcome to the Change Maker \n");

System.out.print("Enter the total amount of change:");
input = keyboard.nextInt();


dollar = input / 100;
modulusdollar = input % 100;
quarter = dollar / 25;
modulusquarter = modulusdollar % 25;
dime = quarter / 10;
modulusdime = modulusquarter % 10;
nickel = dime / 5;
modulusnickel = modulusdime % 5;
penny = nickel / 1;
moduluspenny = modulusnickel % 1;


System.out.print("Amount of change for $" + input + " is: \n");

System.out.print("\t Dollars:" + dollar + "\n");
System.out.print("\t Quarters:" + (modulusdollar / 25)) ;
System.out.print("\t Dimes:" + (modulusquarter / 10));
System.out.print("\t Nickels:" + (modulusdime / 5));
System.out.print("\t Pennies:" + (modulusnickel / 1));
}
}


I suck at this. But I think that syntax is my friend. It's the math that isn't.

:P

(no subject)

Date: 2010-09-23 05:20 am (UTC)
From: [identity profile] kymyrra.livejournal.com
The computer languages, they are unforgiving masters. Can't tell you how many times i've banged my head in frustration at an error code caused by a missing semicolon. And i'm not even writing code, just modifying it. It will get easier for you, and there are tons of resources out there on the internets to help you when you get stuck.

(no subject)

Date: 2010-09-23 10:02 pm (UTC)
From: [identity profile] thrihyrne.livejournal.com
When it works, it's great— but when it doesn't, augh. I tried submitting my program and it wasn't perfect enough. I'm glad I'm not taking the class for a grade because I doubt I'll be able to get a finished product polished enough to succeed the submission process.

(no subject)

Date: 2010-09-23 02:55 pm (UTC)
From: [identity profile] eldritchhobbit.livejournal.com
I suspect you'll make friends with all of it before you're done. You're the gal who taught herself (and then me) HTML, don't forget! :)

*cheers you on*

(no subject)

Date: 2010-09-23 10:02 pm (UTC)
From: [identity profile] thrihyrne.livejournal.com
That's true, but this seems so different… thank you for the supportive words!

(no subject)

Date: 2010-09-23 06:18 pm (UTC)
From: [identity profile] gingerspark.livejournal.com
You'll do great!
you're already better than me at it! ;)

(no subject)

Date: 2010-09-23 10:03 pm (UTC)
From: [identity profile] thrihyrne.livejournal.com
I don't know how I'll end up, but if nothing else, I'm learning the basics and I have a textbook that's checked out for 18 weeks, so I can continue on and teach myself if it comes to that.

January 2023

S M T W T F S
1234567
891011121314
15161718192021
222324252627 28
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Powered by Dreamwidth Studios