Hi! Guys, My name is Tonie and i just joined Daniweb recently. I have a question that is puzzling me that i wanted to get input from other programmers. The questions is below.
I have a friend who wants to have a party, lets call her Kim. She wants to charge $6.00 for every person and $10.00 per couple. Since Kim is awaiting RSVPs from the invites she sent, she has no idea how many of each will show up. She expects the program to allow her to enter these numbers once she receives the RSVPs, and also output a total dollar amount so she will know how much money she can spend on decorations, etc.
I am new to coding and i just need someone to point me to the right direction. I am not asking for the code without effort but i am asking for ideas on how to start.This is a java program
The calculation isn't hard. All you'd need would be some very fundamental arithmetic, a loop, and a branch. If you haven't done so, you should start by reviewing the basics thread stuck to the top of this forum. You'll want to have done the following: - get a basic hello world running - exercise the arithmetic operators and print some results to the screen - make a for loop that adds up the numbers from 1 to, say, 1000 - modify that loop to omit multiples of 13, that is, to only add number n if n is divisible without remainder by 13.
If you understand those things, you should be able to write this without a hitch, and all of those things you should be able to get at least a good start on from the tutorials.
This is what i came up with. I must be doing something wrong because its not working
//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.