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
  • 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, 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...

  • Shady Slim / Comprehensive Deductions Problem Read the following letter and help Shady Slim with his...

    Shady Slim / Comprehensive Deductions Problem Read the following letter and help Shady Slim with his tax situation. Assume that gross income is $172,900 (which consists only of salary) and ignore AGI thresholds for purposes of this problem. December 31, 2020 To the friendly student tax preparer: Hi, it’s Shady Slim again. I just got back from my 55th birthday party, and I’m told that you need some more information from me in order to complete my tax return. I’m...

  • 52. Read the following letter and help Shady Slim with his tax situation. Please assume that...

    52. Read the following letter and help Shady Slim with his tax situation. Please assume that his gross income is $172,900 (which consists only of salary) for purposes of this problem. December 31, 2019 To the friendly student tax preparer: Hi, it's Shady Slim again. I just got back from my 55th birthday party, and I'm told that you need some more information from me in order to complete my tax return. I'm an open book! I'll tell you whatever...

  • Read the following letter and help Shady Slim with hls tax situation. Please assume that his...

    Read the following letter and help Shady Slim with hls tax situation. Please assume that his gross Income Is $173,520 (which consists only of salary) for purposes of this problem. December 31, 2018 To the frlendly student tax preparer: HI·it's Shady Slim again. I just got back from my 55th birthday party, and I'm told that you need some more information from me In order to complete my tax return. I'm an open book! I'll tell you whatever think you...

  • Hello dear, Please i need help to solve this problem in Finance 1. Apply What You’ve...

    Hello dear, Please i need help to solve this problem in Finance 1. Apply What You’ve Learned - Auto Purchase Scenario: You are in the market for a new car. You do not have a trade-in, but you have saved $2,500 toward a down payment. You currently earn $4,000.00 gross monthly income, of which 35% is withheld for various deductions. You have heard of the 20% rule of thumb, but want to limit your payments to no more than 15%...

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
ADVERTISEMENT