Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

EASY PHP SCRIPT PROBLEM! Would prefer you to take screen shot of code and upload

ID: 638878 • Letter: E

Question

EASY PHP SCRIPT PROBLEM!                                                                                                                                    

Would prefer you to take screen shot of code and upload the screenshot(s) as the answer.

Below is a PHP code example to follow when scripting the problem above:

$percentGrade = 0.0;
$letterGrade = "X";

printf(" Enter Percent Grade: ");
fscanf(STDIN, "%f", $percentGrade);

if( $percentGrade >= 90 )
{
$letterGrade = "A";
}
else
{
if( $percentGrade >= 80 )
{
   $letterGrade = "B";
}
else
{
   if( $percentGrade >= 70)
   {
  $letterGrade = "C";
   }
   else
   {
  if($percentGrade >= 60)
  {
    $letterGrade = "D";
  }
  else
  {
    $letterGrade = "F";
  }
   }
}
}
printf(" The letter grade is %s",$letterGrade);

fscanf(STDIN, "%s", $buster);
?>

Explanation / Answer

Algorithm:
Read loanAmount
Set deposit to zero
Set display_output to blank
If loanAmount >= 0 And loanAmount < 25000 Then
    deposit = loanAmount* 5%
    display_output = Currency format of deposit
Else
    If loanAmount >= 25000 And loanAmount <= 49999 Then
        deposit = 1250 + (loanAmount - 25000) * 10%
        display_output = Currency format of deposit
    Else
         If loanAmount >= 50000 And loanAmount <= 100000 Then
            deposit = 5000 + (loan_amount - 50000) * 25%
            display_output = Currency format of deposit
         Else
            display_output = "Error: Loan amount not within acceptable range "
------------------------------------------------------------------------------------------------

PHP Code:

<?php
$loanAmount;
$deposit=0;


printf(" Enter Loan amount: ");
fscanf(STDIN, "%f", $loanAmount);
if($loanAmount >= 0 && $loanAmount < 25000)
{
$deposit = $loanAmount* 0.05;
printf("The deposit is: $ %s", $deposit);
}
else
{
if($loanAmount >= 25000 && $loanAmount <= 49999)
{
$deposit = 1250 + ($loanAmount - 25000) * 0.1;
printf("The deposit is: $ %s", $deposit);
}
else
{
if($loanAmount >= 50000&& $loanAmount <= 100000)
{
$deposit = 5000 + ($loan_amount - 50000) * 0.25;
printf("The deposit is: $ %s", $deposit);

}
else
{
printf("Error: Loan amount not within acceptable range");
}
}
}

?>