SOLVE USING C!!!
Project objective: Conditional statements, loops, reading from file, user defined functions.
**Submit source code (LargeProg1.c) through Canvas
Be sure to save the input.txt file into the same directory as source code file (remember to use your Z drive on portal.eng.fau.edu)
How to Submit:
Submit your source code (LargeProg1.c) by clicking the link, attaching your source code (LargeProg1.c), and clicking submit.
This should be one file and MUST be the file with the .c extension. Submitting the incorrect file may result in no credit for the assignment.
Instructions:
Write a fully executable code.
The program should give the user 3 options:
Option 1: Calculate and display the day of the week of a given date.
Option 2: Calculate and display the principal on a savings account after a given number of years for compounded interest. Compounded interest means that you receive interest on your interest, i.e. if you have $100 on the bank that pays 2% interest, after the first year you will have $102 and after the second year you will have $104.04, the $0.04 being the interest on the interest.
Option 3: Calculate and display the principal on a savings account after a given number of years for simple interest.
After the user chose an option execute the option and ask the user if (s)he wants to end the program. If not, start the program again from the beginning. Implement all options as user defined functions.
Instructions for option 1:
Leap year rules:
In the Gregorian calendar three criteria must be taken into account to identify leap years:
Instructions for option 2:
Instructions for option 3:
#include <stdio.h>
#include<math.h>
double main()
{
int option;
printf("enter the option");
scanf("%d",&option);
switch(option)
{
case 1:get_weekday();
break;
case 2:compoundinterest();
break;
case 3:simpleinterest();
break;
default:printf("invalid option");
}
return 0;
}
int get_weekday(char * str) {
struct tm;
memset((void *) &tm, 0, sizeof(tm));
if (strptime(str, "%d-%m-%Y", &tm) != NULL) {
time_t t = mktime(&tm);
if (t >= 0) {
return localtime(&t)->tm_wday; // Sunday=0, Monday=1,
etc.
}
}
return -1;
}
double compoundinterest()
{
double p;
printf("enter the principal amount");
scanf("%lf",&p);
double r;
printf("enter the rate");
scanf("%lf",&r);
int n;
printf("enter the no of years");
scanf("%d",&n);
double a,x;
x=pow((1+r),n);
a=p*x;
printf("The required amount is:%lf\n",a);
}
double simpleinterest()
{
double p;
printf("enter the principal amount");
scanf("%lf",&p);
double r;
printf("enter the rate");
scanf("%lf",&r);
int n;
printf("enter the no of years");
scanf("%d",&n);
double a;
double x;
x=(1+(n*r));
a=p*x;
printf("The required amount is:%lf\n",a);
}
SOLVE USING C!!! Project objective: Conditional statements, loops, reading from file, user defined functions. **Submit source...
# in C Project objective: Conditional statements, loops, reading from file, user defined functions.**Submit source code (prog3.c) through CanvasOne source code file(unformatted text) will be submittedHere is INCOMPLETE code to get started: prog3.cHere is input.txt file: input.txtThe file name must match the assignmentThe code should be tested and run on a Microsoft compiler before it is uploaded onto CanvasThe code must be submitted on time in order to receive credit (11:59PM on the due date)Late submissions will not be accepted or gradedAll...
Complete task using python code From definitions file: month = ‘February’ year = 1200 Problem 2: Leap Years (2 Points) Your task is to write a program that takes in both a month and year (defined in the definitions file) and outputs the number of days for that month. It should take into account whether the year is a leap year or not. The resulting number of days in a given month/year combo is to be assigned to the variable...
need help on C++ (User-Defined Function) Format all numerical decimal values with 4 digits after the decimal point. Process and sample run: a) Function 1: A void function that uses parameters passed by reference representing the name of a data file to read data from, amount of principal in an investment portfolio, interest rate (any number such as 5.5 for 5.5% interest rate, etc.) , number of times the interest is compounded, and the number of years the money is...
14.Compound Interest hank account pays compound interest, it pays interest not only on the principal amount that was deposited into the account, but also on the interest that has accumulated over time. Suppose you want to deposit some money into a savings account, and let the account earn compound interest for a certain number of years. The formula for calculating the balance of the account afer a specified namber of years is The terms in the formula are A is...
Description: This project focuses on creating a Java class, Date.java, along with a client class, DateCleint.java, which will contain code that utilizes your Date.java class. You will submit both files (each with appropriate commenting). A very similar project is described in the Programming Projects section at the end of chapter 8, which you may find helpful as reference. Use (your own) Java class file Date.java, and a companion DateClient.java file to perform the following: Ask user to enter Today’s...
Write and submit a MIPS Assembly Language program which requests an integer (year) from the user and then invokes a function to determine the beginning date and time of each season. The program must be properly documented which includes in file comments. Note: This is a Computer Science/Engineering course, not a Physics/Astronomy course. The exact time is not expected. Approximations are acceptable. Document your calculation process in the report. Basically, the intent is that you store a reference date and...
Programming language: PYTHON Prompt: You will be creating a program to show final investment amounts from a principal using simple or compound interest. First, get a principal amount from the user. Next, ask the user if simple or compound interest should be used. If the user types in anything other than these options, ask again until a correct option is chosen. Ask the user to type in the interest rate as a percentage from 0 to 100%. Finally, ask the...
c++ and please add tables and everything and make sure program is complete. Write a menu driven program, which would compute compound interest and a monthly payment for a loan. The user will be given a choice to display the info on the screen or to a filo Menu will be the following Enter (1) to calculate your loan monthly payment Enter (2) to calculate your loan monthly payment & write to a file Tips: Compound Interest Formula A =...
In C++, Please help me compute the following flowchart exactly like this requirement: Use while loops for the input validations required: number of employees(cannot be less than 1) and number of days any employee missed(cannot be a negative number, 0 is valid.) Each function needs a separate flowchart. The function charts are not connected to main with flowlines. main will have the usual start and end symbols. The other three functions should indicate the parameters, if any, in start; and...
PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program that reads a values for hour and minute from the input test file timeData.txt . The data read for valid hour and valid minute entries. Assume you are working with a 24 hour time format. Your program should use functions called validateHour and validateMinutes. Below is a sample of the format to use for your output file timeValidation.txt : ...