C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
Bartleby Related Questions Icon

Related questions

Question

Need help converting my pseudocode to python, AND have a flowchart showing everything!
The code:

Main Module
    Call InputModule
End Main Module


Module InputModule
    // This module gets input from the user
    Declare Principal, AnnualRate, Years as Float

    Output "Enter the Principal amount (P): "
    Input Principal

    Output "Enter the Annual Interest Rate (in percentage, e.g., 5 for 5%): "
    Input AnnualRate

    Output "Enter the number of Years to repay the loan: "
    Input Years

    Call DisplayPayment(Principal, AnnualRate, Years)
End Module


Module DisplayPayment(Principal, AnnualRate, Years)
    // This module calculates and displays the monthly payment
    Declare R, N as Float
    Declare MonthlyPayment as Float
    Declare PowerFactor as Float  // second local variable

    // Calculate monthly interest rate R and number of months N
    Set R = (AnnualRate / 100) / 12
    Set N = Years * 12

    // Calculate PowerFactor = (1 + R)^N
    Set PowerFactor = (1 + R) ^ N

    // Calculate Monthly Payment using the given formula
    Set MonthlyPayment = [ (R * PowerFactor) / (PowerFactor - 1) ] * Principal

    Output "The monthly payment is: ", MonthlyPayment
End Module


Pseudocode helped from:
https://www.bartleby.com/s/b991d593-9508-4e20-96a1-42e67c7a1d61

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,