GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

A cross-reference(s) may be needed in a geographic storage s…

A cross-reference(s) may be needed in a geographic storage system for​

Read Details

Subject records storage is​

Subject records storage is​

Read Details

​ Which of the following activities is a part of a disaster…

​ Which of the following activities is a part of a disaster recovery plan?

Read Details

​ Activities included in the implementation of a records ret…

​ Activities included in the implementation of a records retention schedule include

Read Details

Which of the following items are used when removing records…

Which of the following items are used when removing records from numeric records storage?​

Read Details

​ A tickler file containing copies of forms completed when r…

​ A tickler file containing copies of forms completed when records are received in a records center and detailing when the records are scheduled to be destroyed is

Read Details

​ E-commerce allows companies and individuals to conduct bus…

​ E-commerce allows companies and individuals to conduct business through

Read Details

​ The five phases of the records and information life cycle…

​ The five phases of the records and information life cycle are

Read Details

​ Enterprise content management (ECM) is the term used to de…

​ Enterprise content management (ECM) is the term used to describe the technologies, tools, and methods used to

Read Details

Program#2: Vending Machine This vending machine carries only…

Program#2: Vending Machine This vending machine carries only 1 type of drink that costs $1.50 per bottle. The machine can only accept $1 bill, quarter, dime, nickel and penny coins.  1.) Create a user-defined function: Create a C function called convert(). This function accepts one input argument as a single-character (char) type and returns a floating-point value with double precision (double). Utilize switch-case statement within the function convert() to determine the value in dollar of an input character which represents a one-dollar bill or each type of coin as shown in the following table: Type of Cash Input Character Value (dollar) $1 Bill ‘$’ 1.00 Quarter ‘Q’ 0.25 Dime ‘D’ 0.10 Nickel ‘N’ 0.05 Penny ‘P’ 0.01 Other Input Characters: 0.00 Only the five characters: ‘$’, ‘Q’, ‘D’, ‘N’ and ‘P’ are considered as valid inputs. The function convert() should be able to return the corresponding value of the bill or coin to the main function. If the input character is NOT one of the valid characters listed above, the function convert() must return 0.00 2.) In the main function: Create a C program that allows a user to enter a single character from keyboard by using the function: scanf(” %c”, &cash); (notice a space in front of %c) which mimics a scenario of inserting cash into a vending machine. Call the function convert() in the main program to convert the input characters (entered by user) ‘$’, ‘Q’, ‘D’, ‘N’ or ‘P’ into the values of 1.00, 0.25, 0.10, 0.05 or 0.01, respectively. The program should repeatedly display the remaining balance and ask the user to enter a single character as long as there is still a remaining balance. When the remaining balance reaches 0.00 or once the value of cash inserted is greater than the remaining balance, the program should terminate and conclude the amount of change in dollar. Display the remaining balance and the change with 2 decimal places. Hint: Use double precision for the variable: balance Include additional libraries if needed. An example of input/output dialog is shown below: Remaining Balance is $1.50 Insert Cash: $ Remaining Balance is $0.50 Insert Cash: Q Remaining Balance is $0.25 Insert Cash: z Remaining Balance is $0.25 Insert Cash: D Remaining Balance is $0.15 Insert Cash: D Remaining Balance is $0.05 Insert Cash: N Here is your drink! and $0.00 change OR Remaining Balance is $1.50 Insert Cash: P Remaining Balance is $1.49 Insert Cash: Q Remaining Balance is $1.24 Insert Cash: $ Remaining Balance is $0.24 Insert Cash: $ Here is your drink! and $0.76 change Upload your source code (.c file) below: (only .c file will be graded!)

Read Details

Posts pagination

Newer posts 1 … 35,189 35,190 35,191 35,192 35,193 … 75,408 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top