Birthday Party Code
I'm having a party in a few weeks.I want to charge $6 for every person and $10 per couple. I have already sold invitations for people to RSVP and i don't know how many will show up. I need a java program that will allow me to enter these numbers once i get the RSVP's and also output a total dollar amount so i know how much i can spend on drinks and decorations.
And I think I speak for all in welcoming you to the Java-Forums and wishing you much success in creating such a program. Please feel free to come on back if you have any problems with creating this app, but don't forget to show us your code and ask as specific a question as possible since doing this greatly increases your chances of getting decent help.
Originally Posted by tonyfingures
Much luck and again, welcome!
Its admirable you want to make a program to do such a job, but wouldnt a spreadsheet be easier to use, and quicker to set up?
Or is this just a training exercise to see if you can do it?
It's obviously a legitimate question, I'm sure. There's no way that the original poster would post a homework assignment in such a way, just to try to fool us dolts into doing his work for him, right? No one could be that foolish, could they? Or maybe I'm just being naïve. ;)
Originally Posted by berkeleybross
Below is the code that i was hoping would work. I am more into hardware and not coding but i'm trying to understand all this. Your input will be appreciated as long as its positive. I have done this using VB.NET and it works. I know theirs a simpler way to do it using other apps but i want to see it in JAVA.
//Author: Tony Fingers
//Purpose: Inputs the number of couples, singles who have RSVP'd and then calculates the total cost of decorations
public class Decorationcost
public static void main(Stringargs)
int dom, number1, number2;
number1 = 0;
number2 = 0;
dom = Integer .parseInt(JOptionPane.showInputDialog("Enter the guests (1-100) who have RSVP'd."));
number1 = dom * 6;
number2 = dom * 10;
JOptionPane.ShowMessageDialog(null, "Single people who have RSVP'd is: "* number1 * "!");
JOptionPane.ShowMessageDialog(null, "Couples who have RSVP'd is: " * number2 * "!");
} //Closes class.
Are there problems or errors?
Please copy and paste the full text of the error messages here.
Or explain what the problem is.
Well its in CMD promt but its saying that it couldn't find main class
Please copy the full contents of the command prompt showing the command you entered and the response to that error.
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
this is the error.
Exception in thread "main" java.lang.NoClassDefFoundError: Decorationcost
Caused by: java.lang.ClassNotFoundException: Decorationcost
at java.net.URLClassLoader$1.run(URLClassLoader.java: 202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)
Could not find the main class: Decorationcost. Program will exit.
Press any key to continue . . .
You left off part of it:
full contents of the command prompt showing the command you entered
Is there a file named: Decorationcost.class in the folder where you issued the java command?
Did you compile the Decorationcost.java file using the javac command?