The prices of children's books, novels and dictionaries sold in a stationery are determined as follows: Children's book: 5$ each Novel: 0.1 $ per page for the first 200 pages, and an additional 0.05 $ for each page after 200 Dictionary: Pocket dictionaries 7.5 $, large dictionaries $ TL Develop the C program that calculates the price of the book (c, C, r, R, s or S) whose first letter is entered as capital or lowercase letters, by reading the required information for each book type from the keyboard and writing it on the screen. If the type of book or dictionary type is entered incorrectly, an appropriate error message should be displayed on the screen and the program should be terminated. NOTE: For example, enter c or C for pocket dictionary and b or B for large dictionary. Sample Output-1 Sample Output-2 Sample Output-3 Enter the book type (c, C, r, R, s, S): R Enter the number of pages: 250 Total Price = 22.50 TL Enter the book type (c, C, r, R, s, S): s Enter dictionary type (c, C, b, B): x ! ERROR: There's no such type! Enter the book type (c, C, r, R, s, S): O ! ERROR: There is no book type like that! Important Note: We should do this with using if, if else, switch case. Could you solve basicly, not complex please. Also, you can see sample output, it is in attachment.
The prices of children's books, novels and dictionaries sold in a stationery are determined as follows:
Children's book: 5$ each
Novel: 0.1 $ per page for the first 200 pages, and an additional 0.05 $ for each page after 200
Dictionary: Pocket dictionaries 7.5 $, large dictionaries $ TL
Develop the C program that calculates the price of the book (c, C, r, R, s or S) whose first letter is entered as capital or lowercase letters, by reading the required information for each book type from the keyboard and writing it on the screen. If the type of book or dictionary type is entered incorrectly, an appropriate error message should be displayed on the screen and the program should be terminated.
NOTE: For example, enter c or C for pocket dictionary and b or B for large dictionary.
Sample Output-1 |
Sample Output-2 |
Sample Output-3 |
Enter the book type (c, C, r, R, s, S): R Enter the number of pages: 250 Total Price = 22.50 TL
|
Enter the book type (c, C, r, R, s, S): s Enter dictionary type (c, C, b, B): x ! ERROR: There's no such type! |
Enter the book type (c, C, r, R, s, S): O ! ERROR: There is no book type like that! |
Important Note: We should do this with using if, if else, switch case. Could you solve basicly, not complex please. Also, you can see sample output, it is in attachment.
Step by step
Solved in 2 steps