Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Just add onto this code, this is a starting point. The problem is below the code. Thanks!

Just add onto this code, this is a starting point. The problem is below the code. Thanks!

//reading from a file and print it out

$str=file_get_contents("course.txt");

/*

print "Content of the test file in this directory is: ";

print "$str";

print " ";

*/

print " Print each row as array element:";

$array=explode(" ",$str);

print " ";

$num=0;

$den=0;

$b="";

for($i=0;$i

print "$array[$i] ";

$b=explode(" ",$array[$i]);

echo 'Credit hours : ';

echo $b[2];

$den=$den+$b[2];

echo "Grade : ";

echo $b[3];

echo ' ';

if($b[3]=="A")

$num=$num+$b[2]*4;

else if($b[3]=="B")

$num=$num+$b[2]*3;

else if($b[3]=="C")

$num=$num+$b[2]*2;

else if($b[3]=="D")

print ' ';

}

print("num = ".$num);

print ' ';

print "den = ".$den;

print ' ';

print("Your current gpa is ");

print $num/$den;

?>

image text in transcribed

image text in transcribed

image text in transcribed

O 00 AutoSave OFF AO 2-0 ... Lab7(1) Qe Home Insert Draw Design Layout References Mailings Review View Tell me Share Comments X 0, AaBbCcDdEe A: BucDdEe: Paste Calibri (Bo... v 11 ~ A k Aav y=v=v | | BIU UvX x A-ZA LAUPUG Turun won ITC Normal No Spacing Dictate Styles Pane Sensitivity In this lab, you will be working on PHP code to read information from a file and create an HTML(PHP) file. The file that you will be reading will have the following information: Item-purchased taxable-or-not quantity cost-of-one-unit Example: Watermelon N 24.99 Coke-box Y 3 2.98 Cabbage N 10.78 Green-paper N 3 0.58 Paint Y 1 24.99 Tea N 1 1.99 The second parameter Y/N in each line indicates if item is taxable or not. If it is Y, then item is taxable, and customer should pay 6% KY tax for that item. Once your code reads the information from a file, the code should 4provide a receipt as follows: Logo for the company (information for customer) Name: Date:MM/DD/YYYY Time:HH/MM Page 1 of 2 179 words (* English (United States) * Focus E Erg 175% OO AutoSave OFF AOOO... Lab7(1) Qe Home Insert Draw Design Layout References Mailings Review View Tell me Share V Comments X Calibri (Bo... v 11 ~ A Aar A ST 0, AaBb CeDdle A: BucDdEt Paste BIU va x No Spacing x AZA Normal Dictate Styles Pane Sensitivity Logo for the company information for customer) Name: Date:MM/DD/YYYY Time:HHMM List of purchased items. For example Watermelon T Coke-box Cabbage Green-paper T Paint Tea Tax, Cost, and total payment Your name tag Page 1 of 2 179 words * English (United States) Focus E ER 175% OO AutoSave OFF AOOO... Lab7(1) Qe Home Insert Draw Design Layout References Mailings Review View Tell me Share V Comments G X [0 Calibri (Bo... V 11 21 ST AaBbCeDdEe 0 A: BucDdEet AP Aa v X ALA Paste BIUvab Normal No Soacing Dictate Styles Pane Sensitivity You need to have the most outer box, but inner boxes are up to you. Even if you do not have boxed for those sections, they need to be distinctive and separate from each other so that it is easy to see. Note that the taxable items have I before its name, indicating that it is Taxable item. Page 2 of 2 179 words * English (United States) Focus E ER 175% O 00 AutoSave OFF AO 2-0 ... Lab7(1) Qe Home Insert Draw Design Layout References Mailings Review View Tell me Share Comments X 0, AaBbCcDdEe A: BucDdEe: Paste Calibri (Bo... v 11 ~ A k Aav y=v=v | | BIU UvX x A-ZA LAUPUG Turun won ITC Normal No Spacing Dictate Styles Pane Sensitivity In this lab, you will be working on PHP code to read information from a file and create an HTML(PHP) file. The file that you will be reading will have the following information: Item-purchased taxable-or-not quantity cost-of-one-unit Example: Watermelon N 24.99 Coke-box Y 3 2.98 Cabbage N 10.78 Green-paper N 3 0.58 Paint Y 1 24.99 Tea N 1 1.99 The second parameter Y/N in each line indicates if item is taxable or not. If it is Y, then item is taxable, and customer should pay 6% KY tax for that item. Once your code reads the information from a file, the code should 4provide a receipt as follows: Logo for the company (information for customer) Name: Date:MM/DD/YYYY Time:HH/MM Page 1 of 2 179 words (* English (United States) * Focus E Erg 175% OO AutoSave OFF AOOO... Lab7(1) Qe Home Insert Draw Design Layout References Mailings Review View Tell me Share V Comments X Calibri (Bo... v 11 ~ A Aar A ST 0, AaBb CeDdle A: BucDdEt Paste BIU va x No Spacing x AZA Normal Dictate Styles Pane Sensitivity Logo for the company information for customer) Name: Date:MM/DD/YYYY Time:HHMM List of purchased items. For example Watermelon T Coke-box Cabbage Green-paper T Paint Tea Tax, Cost, and total payment Your name tag Page 1 of 2 179 words * English (United States) Focus E ER 175% OO AutoSave OFF AOOO... Lab7(1) Qe Home Insert Draw Design Layout References Mailings Review View Tell me Share V Comments G X [0 Calibri (Bo... V 11 21 ST AaBbCeDdEe 0 A: BucDdEet AP Aa v X ALA Paste BIUvab Normal No Soacing Dictate Styles Pane Sensitivity You need to have the most outer box, but inner boxes are up to you. Even if you do not have boxed for those sections, they need to be distinctive and separate from each other so that it is easy to see. Note that the taxable items have I before its name, indicating that it is Taxable item. Page 2 of 2 179 words * English (United States) Focus E ER 175%

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions