CIS1500_Assignment3_Description_updated

.pdf

School

University of Guelph *

*We aren’t endorsed by this school

Course

1300

Subject

Computer Science

Date

Apr 3, 2024

Type

pdf

Pages

12

Uploaded by MajorThunderIbex35

Report
1) CIS1500 Assignment 3: Student Finance Calculator a) Total Marks: 10 marks b) Weight: 10% c) Due: Friday, 1st Dec 2023, at 11:59 pm Welcome to your last CIS1500 assignment! Please ensure you read all the sections and follow the instructions exactly as we will grade your submission with an auto-grader. You must test your assignment on the SoCS Linux server , and it will be similarly graded on the SoCS Linux server for consistency. Your program should only use concepts already taught in this course. You will receive a 0 if your code includes: global variables (variables declared outside of functions), goto, malloc, calloc, regex, or if your code fails to compile without errors. Note there are already two global constants provided for you in the .h file. This pdf goes in conjunction with videos available on courselink. There is also a file containing “Skeleton Code”; you should use this as your starting point. It contains 3 files: 2) A .c file for your main called skeleton.c. You must rename this before submitting. 3) A .c file for your functions called A3_Functions.c. Do not rename this before submitting. 4) A .h file for function prototype called A3_Functions.h. This file is already completed, do not modify it. You do not need to submit it. This document has 15 pages. Read them all and understand the requirements. REMEMBER: You are to submit one zip file containing two source code files for your program. The name of the zip file follows the following format: studentNumberA3.zip o Example: John Snow’s student number is 1770770 then the zip file name is 1770770A3.zip The two files within the zip you are to submit are non-compiled code C files (ends with .c) containing your code o Do not include any other files or folders in your submission; they will be ignored. o Do not include this file inside another folder; it will be ignored by the auto-grader. The name of the C file containing your main follows the following format: studentNumberA3.c o Example: John Snow’s student number is 1770770 then the C file name is 1770770A3.c The name of the C file containing your functions is A3_Functions.c Incorrect submission will result in a grade of 0. More details are outlined in Section 4: Program Submission and Administration Information. Start Early. Get Help Early. Test Often.
1. Background Please refer to the A1 and A2 outline for background, as this assignment is heavily based on A2. You need to thoroughly understand both assignment outlines. In this assignment we will make 3 major changes: A menu is displayed asking the user what the wish to do. Finance data is located in files, they can be loaded from files to view, or new files can be created with the program. We can change the “budget rules”, whereas previously we had hardcoded a 50/30/20 rule, it can now be set and changed to bette When finance data is loaded, it is kept in a struct that is provided. We are able to store finance information for multiple people/years so an array of structs is required. The output of your program should look very similar to that of A2 with three exceptions: We use a menu system for the user to select options. We request a name and year for finance data in addition to the actual finance information. This program is intended to test your ability to: Use structs, pass them to functions, return from functions, and modify the members. Read and write data from/to text files. This is an example of the contents of the data file. We have provided multiple sample files for you to test your code with. When testing we will only use valid input files, with the exact format as those provided. The course and assignment are not intended as actual finance advice.
2. Program Requirements Your program will start with a welcome message, then prompt the user to select an option from a menu. The menu requires the user to enter an integer value associated with the member option. i) 2.1 Required Functions and Menu This assignment has 5 options, each requiring 1 or two mandatory functions: 1) Read finances from file. This option will allow the user to enter a filename, which will load the data from that associated file. The filename is passed into the function FinanceData readFinanceDataFromFile(char filename[]); which will create a FinanceData struct, set the members of the struct to the appropriate values, and then return the struct. Most of the data for the members are stored in the file, but some values (ex. monthly_funds) may need to be calculated within the function. If a file cannot be loaded the message “Error: File not found\n” is displayed. Below is an example of the program output
2) Enter finances and save to file If the user selects option 2, they are prompted to enter a filename. Then the function FinanceData readFinanceDataFromUser(); is called which asks the name and year for the finances. Then the questions from A2 are asked to obtain finance information. This information is all loaded into a newly created struct, and that struct is returned. Remember that some of the struct members will require you to perform calculations based on the input. After the struct is created and added to an array of structs for future use, the struct is passed to the function void saveFinanceRecordToFile(FinanceData fd, char filename[MAX_STRING_LEN]); which saves the data the filename recorded previously.
3) Enter budget rules (ex. 50/30/20). While previously we always followed 50/30/20 rules - for expenses, wants, and savings - in A3 the user may choose to select new ratios. So a user may instead opt to have ratios 70/30/0 for 70% of funds going to expenses, 30% for wants, and 0% for savings. To do this you will need variables that store these rations, and use the function void getBudgetRules(int *essentials_ratio, int *wants_ratio, int *savings_ratio); which takes the ratios as a reference and modifies them based on the user input. *** Hints: - I recommend starting with option 2. It is separated into two parts, you can copy a lot of your A2 code for reading input and create the struct. After you have tested that and other features, you can work on saving the struct to a file later. - Next I would work on option 4, this option mostly uses existing code that we provided, and gives you a chance to verify the output. - Thirdly I would work on option 3. Now that you have the ability to print the finance data you can verify that it works. - Remember that you can add print statements for testing wherever you need. This is often the easiest and most effective way to test that your code is doing what you think, and helps tremendously with debugging.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help