Question

Hello, I need help implementing a program in f# for an example problem: "Suppose that the tuition...

Hello, I need help implementing a program in f# for an example problem: "Suppose that the tuition for a university is $10,000 this year and increases 5% every year. In one year, the tuition will be $10,500. Write a program that displays the tuition in 10 years and the total cost of 4 years’ worth of tuition starting after the 10th year." I don't have a lot of experience with functional programming languages. Can someone show me how to go about doing this? It's hard to think about things functionally when I'm so used to thinking about things imperatively. Thank you in advance.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
open System
[<EntryPoint>]
let main (args : string[]) =
      
        printfn "Enter the tution fee";
        let tutionfee = Console.ReadLine();
        
        printfn "Enter fee increase rate";
        let rate = Console.ReadLine();

//Loop to find total tution fee after 10 years

for i = 1 to 10 do
    let futureValue1    = tutionfee * ((1.00 + i) ** rate);
    let interestEarned1 = futureValue1 - tutionfee;
let totalamount1 = futureValue1;

//Loop to find total tution fee after 10 years

for i = 1 to 4 do
    let futureValue2    = tutionfee * ((1.00 + i) ** rate);
    let interestEarned2 = futureValue2 - tutionfee;
let totalamount2 = futureValue2;

printfn "The Tution fee after 10 years is %f" totalamount1;
printfn "The Tution fee after 2 years is %f" totalamount2; 

    
0
Add a comment
Know the answer?
Add Answer to:
Hello, I need help implementing a program in f# for an example problem: "Suppose that the tuition...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I NEED THIS PROGRAM COMPLETE WITH THE INPUT ALREADY IN IT. I HAVE NO TIME LEFT...

    I NEED THIS PROGRAM COMPLETE WITH THE INPUT ALREADY IN IT. I HAVE NO TIME LEFT TO GET IT DONE AND IT'S BEEN KICKING MY BEHIND FOR THE PAST FEW DAYS. THIS IS MY FINAL PROGRAM AND I HAVE NO CLUE ABOUT WHAT I'M DOING. SO, IF SOME WILL...WILL YOU PLEASE DO THE PROGRAM WITH THE INPUT ALREADY IN IT...I JUST WANT TO BE ABLE TO COPY PASTE AND RUN IT. I WOULD APPRECIATE IT A HECK OF A LOT....

  • Hello, I need help with writing this program out in Python. I use jGrasp for this...

    Hello, I need help with writing this program out in Python. I use jGrasp for this problem as well any help will be appreciated. Programming Exercises 157 THON 18. Restaurant Selector You have a group of friends coming to visit for your high school reunion, and you want to take them out to eat at a local restaurant. You aren't sure if any of them have dietary restrictions, but your restaurant choices are as follows: Joe's Gourmet Burgers-Vegetarian: No, Vegan:...

  • Hello, I really need help with this problem ASAP. Any help is much appreciated and I'll...

    Hello, I really need help with this problem ASAP. Any help is much appreciated and I'll give a thumbs up. Thank you in advance. On January 1, the Matthews Band pays $68,000 for sound equipment. The band estimates it will use this equipment for four years and after four years it can sell the equipment for $1,000. Matthews Band uses straight-line depreciation but realizes at the start of the second year that this equipment will last only a total of...

  • hello, I need a little help with this problem in the second part. I have tried...

    hello, I need a little help with this problem in the second part. I have tried working the example and I was able to do it, but not my actual problem. You estimate that by the time you retire in 35 years, you will have accumulated savings of $2.5 million. a. If the interest rate is 10.5% and you live 15 years after retirement, what annual level of expenditure will those savings support? (Do not round intermediate calculations. Round your...

  • Hello Sir, I need help with Java. Here is the problem below. Problem 1.Write a program...

    Hello Sir, I need help with Java. Here is the problem below. Problem 1.Write a program that prompts the user to enter the number of milliseconds and converts the milliseconds to a string hours:minutes:seconds. The program should use the convertMillismethod with the following header: public static String convertMillis(long millis) For example, convertMillis(5500) returns the string 0:0:5, convertMillis(100000) returns the string 0:1:40, and convertMillis(555550000) returns the string 154:19:10. Problem 2. (Count occurrence of numbers)Write a program that reads integers between 1...

  • In C++, you are implementing the vector class in the VectorStub zip. You need to implement...

    In C++, you are implementing the vector class in the VectorStub zip. You need to implement all of the methods, and that's it. You cannot add any new properties. Your solutions must conform to the Big O notations next to each method. A few things to remember about templates: All the code is in the h file When testing a template, any method you don't call gets deleted. So make sure you test them all, or you might secretly have...

  • Hello, my name is Shady Slim. I understand you are going to help me figure out...

    Hello, my name is Shady Slim. I understand you are going to help me figure out my gross income for the year... whatever that means. It's been a busy year and I'm a busy man, so let me give you the lowdown on my life and you can do your thing I was unemployed at the beginning of the year and got $2,000 in unemployment compensation. I later got a job as a manager for Roca Cola. I earned $56,500...

  • Hello. There is a question that I am stuck at, I have no clue how to...

    Hello. There is a question that I am stuck at, I have no clue how to do it. It is LONG Accounting Transactions – Hair Today: Charlene Jackson’s business, Hair Today, has been operating in Auckland for the month of February 2020. It is set up as a sole trader. You call in for a haircut, and while she is trimming your hair, she tells you how business is going. “I think it’s going very well,” she says. “Last time...

  • Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers...

    Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...

  • Hello, please solve this problem for object oriented programming in C++ program language. I have final...

    Hello, please solve this problem for object oriented programming in C++ program language. I have final tomorrow so it will be very helpful. thank you. PROBLEM 1: application that simulates the highway Create an In order to solve above mentioned requirements, it is necessary to implement several classes: 1. Class Vehicle contains information about the vehicles that drive on the highway. Each vehicle has information about its a Type (can be one of these: Motorcycle, Car, Truck) b. License number...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT