Hi all,
Forgive me if my questions are too silly. I am a Java beginner (very much of a beginner), and I received the following assignment:
"Many public schools in California are experiencing a shortage of funds for special student activities. Some schools started Jog-A-Thons as a fundraiser. Each student gathers sponsors for a particular amount per lap jogged. Write a program that tracks this activity.
The program repeats until all sponsors are entered. It accumulates the grand total funds owed the school. For each sponsor, the program prompts for the name of the student. It then prompts for the sponsors’ name, and amount pledged for each lap. The program asks if the sponsor is a company (Y/N). Then the program prompts for the amount of laps the student actually jogged. The program calculates the amount owed to the school (pledge times laps). If the sponsor is not a company, the maximum amount owed the school is set to $100.00, (There is no maximum if the sponsor is a company). Finally, display on the screen the students name and sponsor name changed to all uppercase (whether or not it was entered in upper case), the pledge amount, the number of laps, and the amount calculated. Prompt if there is another sponsor (Y/N). After all sponsors are entered successfully, display the grand total funds owed the school. All money must be formatted appropriately."
So, I am stuck at figuring out how to write at the Y/N cases.
here is what I've got so far:
.......
import java.util.Scanner; // Import the Scanner Class Library
import java.text.*;
public class Exam
{
public static void main(String args[])
{
// variable declaration
String s;
int st_name, spon_name, laps, amountSchool, count = 0;
double dolla;
double total = 0;
Scanner Keyboard = new Scanner(System.in); //Create Scanner object "Keyboard"
/ Print Title
System.out.print( "\t\t\tMy Jog-A-Thon Fundraising Activity\n\n" );
// Prompt for student name
System.out.println("\tEnter student's name: ");
st_name = Keyboard.nextInt();
System.out.print("\nEnter sponsor's name: ");
spon_name = Keyboard.nextInt();
// Ask For Pledge Amount
System.out.print( "\n\n\n\t\t\tEnter U.S. dollar amount pledged for each lap: \n\t\t\t" );
dolla = Keyboard.nextDouble();
// Ask If Sponsor is a Company
System.out.print( "\n\n\n\t\t\tIs the sponsor a company (Y/N)?\n\t\t\t" );
System.out.print( "\n\n\n\t\t\tPlease type Y for 'yes' and N for 'no'\n\t\t\t" );
s = Keyboard.nextLine();
choice = s.charAt(0);
...........................
And I am stuck from here on. I need to find total, if s = n or N, total needs to be no more than 100, but if s = y or Y, I can have any total.
Please help, I appreciate any input!