7.8k views
3 votes
Donations Complete the following flowgorithm problem: 1. Use only concepts found in Units 1&2 2. Do not use modules 3. Submit the flowgorithm file, the one that ends with ".fprg" You work as an intern at a local charity. The charity receives donations on a regular basis. Your supervisor would like you to design a program that will: - Prompt the user for two input donations - Calculate and display the total donations collected - Seven and one half percent (7.5%) of the donations go to a children's hospital. - Calculate & display the amount to be donated to the children's hospital - Close the program with a thank you message. - Include your name and current date as a comment at the top of the flowchart - Include comments throughout your design for logic clarity - Upload the Flowgorithm file in Brightspace under the assignment link. Sample Input Enter the first donation: 250 Enter the second donation: 1000 Sample Output The total donations are: $1250 The children's hospital will receive $75 Thank you for using this program. Your program should calculate any donation amount, the above is only test data. Use your name and lab number as part of the submitted file name as follows: studentNameLab2-0.fprg, i.e. "susanSmithLab2-0.fprg" The Following Applies to All Flowgorithm Labs 1. In order to receive the maximum grade (50) your Flowgorithm lab must minimally meet all the following requirements: a. FLOWGORITHM PROGRAMS CONTAIN ERRORS - UNACCEPTABLE b. Comment block at the beginning of the flowchart that includes: i. Student name ii. Date work started iii. Statement of the purpose of program, i.e. what is the program going to do? c. Clear, succinct input prompts for the user i. Use of system input prompt - NOT ACCEPTABLE ii. "Input number" - NOT ACCEPTABLE iii. "Input a numeric value for the student's grade" - ACCEPTABLE iv. "Enter name" - NOT ACCEPTABLE v. "Enter the first name of the applicant" - ACCEPTABLE d. Descriptive labels of output names and numbers i. 45 - NOT ACCEPTABLE ii. " T The sum of the numbers is 45 " - ACCEPTABLE iii. Fred - NOT ACCEPTABLE iv. " The applicant's first name is Fred" - ACCEPTABLE v. The total of the numbers is 125.65 - NOT ACCEPTABLE vi. The total of the numbers is 125.65 - ACCEPTABLE e. DO NOT 'hard-code' numbers in calculation statements i. Total =5+7− NOT ACCEPTABLE ii. Total = Number01 + Number02 − ACCEPTABLE f. Use your name as part of the submitted file name, examples below: i. studentName_flowgorithmLabNumber.fprg 1. susanSmith_flowgorithm2-0.fprg 2. Alones_flowgorithm4-1.fprg ii. ALWAYS USE THE CORRECT FLOWGORITHM LAB NUMBER AS PART OF THE FILE NAME SUBMITTED iii. Points deducted for incorrect file names g. It is up to you to choose the appropriate data type for each variable or constant, i.e. integer, real, string etc. h. All input, output and processing requirements listed in the Flowgorithm lab description must be met in order to receive a grade of 50 (considered an a

A n
). Once a lab is submitted and graded the grade is final.

User Degratnik
by
8.8k points

1 Answer

5 votes

Here is the Flowgorithm code for the donations program, including comments and following the specified requirements:

flowgorithm

// Program Name: Donations_JohnSmithLab2-0.fprg

// Date: 2023-12-13

// Purpose: This program calculates donations, displays the total and hospital donation, and thanks the user.

// Initialize variables

donation1: real; // First donation amount

donation2: real; // Second donation amount

totalDonations: real; // Total of both donations

hospitalDonation: real; // Donation for children's hospital

// Prompt for first donation

write "Enter the first donation: ";

read donation1;

// Prompt for second donation

write "Enter the second donation: ";

read donation2;

// Calculate total donations

totalDonations = donation1 + donation2;

// Calculate children's hospital donation (7.5%)

hospitalDonation = totalDonations 0.075;

// Display total donations

write "The total donations are: $" & totalDonations;

// Display children's hospital donation

write "The children's hospital will receive: $" & hospitalDonation;

// Thank the user

write "Thank you for using this program!";

// End program

end;

This code should meet all the specified requirements and calculate any donation amount.

User Hindol
by
7.5k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.