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...
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...
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...
C PROGRAM, A FOPEN FILE NEED TO BE CREATED Objective To review reading from a file. To use records (an instance of a struct) To use Dynamic Memory Allocation To create and use a dynamically allocated array of structs To use enumerated types in a useful manner (more info given on Discussion board!) The Problem Bad economic times has forced the UCF administration to think outside the box for alternative methods of income. Specifically, we now have a UCF lottery,...
Hi, can you please help me with this question. I need it to be in C++. Please without struct and files. Only with functions bc I didnt learn struct and files yet. Many computer applications, such as Microsoft Excel, can compare date values that occur after January 1, 1900. For example, these programs can determine if 06/06/99 is less than (comes before) 11/01/00. They use January 1, 1900 as their reference point. This becomes day 1. All other dates are...
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...
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...