Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is PHP website language and this is not Java or Python language Lab 3.1 (3 points) Download file for lab 3.1: https://www.dropbox.com/s/yeynmnjgrajt5uy/ch08_ex1.zip?dl=0 Lab 3.2

This is PHP website language and this is not Java or Python language

Lab 3.1 (3 points)

Download file for lab 3.1: https://www.dropbox.com/s/yeynmnjgrajt5uy/ch08_ex1.zip?dl=0

image text in transcribed

Lab 3.2 (2 points)

Download file for this lab 3.2 : https://www.dropbox.com/s/3jkd21ct1l1texi/ch08_ex2.zip?dl=0

image text in transcribed

Open and test the application 1. Run the application in the ex_starts/ch08_exl directory. Then, test this appli- cation by entering either "R" or "C" in the Customer Type box and a value from 0 to 500 in the Invoice Subtotal box. When you click on the Calculate button, you can see that the discount percent is based on both the customer type and subtotal amount. Open the index.php and invoice_total.php files for this application and review the code. Note that this code uses nested if statements to determine the discount percent 2. Change the code that determines the discount percent 3. Change the if statement so customers of type R with a subtotal that's greater than or equal to $250 but less than $500 get a 25% discount and those with a subtotal of $500 or more get a 30% discount. Next, change the if statement so customers of type C always get a 20% discount. Then, test these changes Add another type to the if statement so customers of type T get a 40% discount for subtotals of less than $500, and a 50% discount for subtotals of S500 or more. Also, make sure that customer types that aren't R, C, or T get a 10% discount. Then, test these changes. 4. 5. Test the application again, but use lowercase letters for the customer types 6. Modify the code so the users can enter either capital or lowercase letters for Use a switch statement with nested if statements to get the same results Note that these letters aren't evaluated as capital letters. the customer types. To do that, use logical operators. Then, test this change Code a switch statement right before the if statement. This statement should provide the structure for handling the three cases for customer types: R, C, and T. Then, within each of these cases, you can copy the related code from the if statement below to provide for the discounts that are based on subtotal variations. In other words, you can nest the if statements within the switch cases 7. 8. Comment out the entire if statement that's above the switch statement. Then, test to make sure the switch statement works correctly. If you haven't done so already, modify the switch statement so it works for both lowercase and uppercase entries of the three customer types. To do that, use the strtoupper function to convert the customer type to uppercase before it's evaluated. Then, test that change 9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions

Question

Explain the role that peer group dynamics play in hate crimes.

Answered: 1 week ago