Hello, This program handles values only up to $99.99. Please modify to handle values up to $999.99. *****WOULD BE GRATEFUL IF YOU COULD HIGHLIGHT CHANGES MADE**** #include int main( void ) { // word equivalents of single digits char *digits[ 10 ] = { "", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE"}; // word equivalents of 10-19 char *teens[ 10 ] = { "TEN", "ELEVEN", "TWELVE", "THIRTEEN", "FOURTEEN", "FIFTEEN", "SIXTEEN", "SEVENTEEN", "EIGHTEEN", "NINETEEN"}; // word equivalents of tens digits char *tens[ 10 ] = { "", "TEN", "TWENTY", "THIRTY", "FORTY", "FIFTY", "SIXTY", "SEVENTY", "EIGHTY", "NINETY"}; int dollars; // check dollar amount int cents; // check cents amount int digit1; // ones digit int digit2; // tens digit // get check amount printf( "%s", "Enter the check amount ( 0.00 to 99.99 ): " ); scanf( "%d.%d", &dollars, ¢s ); puts( "\nThe check amount in words is:" ); // print equivalent words if ( dollars < 10 ) { printf( "%s ", digits[ dollars ] ); } // end if else if ( dollars < 20 ) { printf( "%s ", teens[ dollars - 10 ] ); } // end else if else { digit1 = dollars / 10; // ones digit digit2 = dollars % 10; // tens digit // if ones digit is zero if ( 0 == digit2 ) { printf( "%s ", tens[ digit1 ] ); } // end if else { printf( "%s-%s ", tens[ digit1 ], digits[ digit2 ] ); } // end else } // end else printf( "and %d/100\n", cents ); } // end main

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Hello,

This program handles values only up to $99.99. Please modify to handle values up to $999.99. *****WOULD BE GRATEFUL IF YOU COULD HIGHLIGHT CHANGES MADE****

#include <stdio.h>

int main( void )
{

// word equivalents of single digits
char *digits[ 10 ] = { "", "ONE", "TWO", "THREE", "FOUR",
"FIVE", "SIX", "SEVEN", "EIGHT", "NINE"};

// word equivalents of 10-19
char *teens[ 10 ] = { "TEN", "ELEVEN", "TWELVE", "THIRTEEN",
"FOURTEEN", "FIFTEEN", "SIXTEEN",
"SEVENTEEN", "EIGHTEEN", "NINETEEN"};

// word equivalents of tens digits
char *tens[ 10 ] = { "", "TEN", "TWENTY", "THIRTY", "FORTY",
"FIFTY", "SIXTY", "SEVENTY", "EIGHTY",
"NINETY"};
int dollars; // check dollar amount
int cents; // check cents amount
int digit1; // ones digit
int digit2; // tens digit

// get check amount
printf( "%s", "Enter the check amount ( 0.00 to 99.99 ): " );
scanf( "%d.%d", &dollars, &cents );
puts( "\nThe check amount in words is:" );

// print equivalent words
if ( dollars < 10 ) {
printf( "%s ", digits[ dollars ] );
} // end if
else if ( dollars < 20 ) {
printf( "%s ", teens[ dollars - 10 ] );
} // end else if
else {
digit1 = dollars / 10; // ones digit
digit2 = dollars % 10; // tens digit

// if ones digit is zero
if ( 0 == digit2 ) {
printf( "%s ", tens[ digit1 ] );
} // end if
else {
printf( "%s-%s ", tens[ digit1 ], digits[ digit2 ] );
} // end else
} // end else

printf( "and %d/100\n", cents );
} // end main

 

 

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education