PHP Beginner
Posted: Thu Jun 17, 2010 4:56 am
I have 3 programs that I need to create and I am stuck on all of them. It would be awesome if someone could help me out. I'm sure that they are pretty simple to most people.
1. Create a script that calculates the minimum number of fifty-dollar bills, twenty-dollar bills, ten-dollar bills, one-dollar bills, quarters, dimes, nickels, and pennies that you would need based on any dollar amounts entered. Make sure the program checks that no negative numbers can be entered (otherwise print an invalid message to the screen). Create an HTML document containing a form with one text box for the dollar amount. Use the appropriate decision structure to create the program.
For this one I was able to create the HTML document I just have no idea where to begin on the php code.
2. You can determine whether a year is a leap year by testing if it is divisible by 4. However, years that are also divisible by 100 are not leap years, unless they are also divisible by 400, in which case they are leap years. Write a script that allows a user to enter the year and then determines whether the year is a leap year. Use a PHP document and an HTML document containing a form with a single textbox to enter the year. Print a message to the user stating whether the year they entered is a standard year or a leap year.
For this one I was able to create the HTML document and some of the coding, however my logic is incorrect and I'm not sure if I used the functions properly.
3. Write a script that allows a user to enter a numeric grade and then determine the letter grade. Use a PHP document and an HTML document containing a form with 5 text boxes to enter the numeric grades. Print a message to the user stating whether or not the grade is valid (remember the numeric grade can only be between 0-100), and the letter grade for each numeric grade entered. Use the grade determination criteria from the syllabus. Example if a grade between 90-93 is entered, a letter of A- will display to the screen. If only 4 grades were entered, then only 4 letter grades should be listed to the screen. Extra credit: Determine the users GPA based on the grades entered.
For this one I was able to create the HTML document with the 5 textboxes and submit button but I really have no idea how to start the PHP code.
1. Create a script that calculates the minimum number of fifty-dollar bills, twenty-dollar bills, ten-dollar bills, one-dollar bills, quarters, dimes, nickels, and pennies that you would need based on any dollar amounts entered. Make sure the program checks that no negative numbers can be entered (otherwise print an invalid message to the screen). Create an HTML document containing a form with one text box for the dollar amount. Use the appropriate decision structure to create the program.
For this one I was able to create the HTML document I just have no idea where to begin on the php code.
2. You can determine whether a year is a leap year by testing if it is divisible by 4. However, years that are also divisible by 100 are not leap years, unless they are also divisible by 400, in which case they are leap years. Write a script that allows a user to enter the year and then determines whether the year is a leap year. Use a PHP document and an HTML document containing a form with a single textbox to enter the year. Print a message to the user stating whether the year they entered is a standard year or a leap year.
For this one I was able to create the HTML document and some of the coding, however my logic is incorrect and I'm not sure if I used the functions properly.
3. Write a script that allows a user to enter a numeric grade and then determine the letter grade. Use a PHP document and an HTML document containing a form with 5 text boxes to enter the numeric grades. Print a message to the user stating whether or not the grade is valid (remember the numeric grade can only be between 0-100), and the letter grade for each numeric grade entered. Use the grade determination criteria from the syllabus. Example if a grade between 90-93 is entered, a letter of A- will display to the screen. If only 4 grades were entered, then only 4 letter grades should be listed to the screen. Extra credit: Determine the users GPA based on the grades entered.
For this one I was able to create the HTML document with the 5 textboxes and submit button but I really have no idea how to start the PHP code.