Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 1: Calculating time taken to pay off credit card Problem. Create a program to calculate how many months it will take to pay off

Assignment 1: Calculating time taken to pay off credit card

Problem. Create a program to calculate how many months it will take to pay off a credit card given current credit card balance, annual percentage rate, the monthly payment amount. Add 10% to the monthly payment and recalculate the number of months. Report the results in a table.

Input: Prompt for

the clients name

the current credit card balance

the Annual Percentage Rate (APR)

the amount of money you can be paid monthly.

Formula:

n = log(1 (Ai/P))/log(1 + i)

Where,

n = Number of Months to payoff credit card

A = Amount on credit card

i = Monthly Rate (APR / 12)

P = Monthly Payment Amount

Constraints:

Enter the APR as an integer. A 22% interest rate would be entered as 22. Have the program convert this to the correct rate: .22.

Display the payoff months as a whole number - fractional months dont make sense.

Use the literal MONTHS_IN_YEAR rather than 12 in formulas requiring the number of months (if you need any).

Keep the Input, Processing, and Output sections of your code separate, use modular hierarchical design. Design functions to prompt and read client name, prompt and read API, prompt and read monthly payments, prompt and read current credit card balance, calculate the number of months (using helper functions as needed) and display the results in a tabulated form.

Use one of the C++ libraries for the log() function.

Output: Sample Run

Discussion.

The hardest part of this assignment is getting the formula right. Take your time and break it up into parts - dont try to fit the formula on one line. This will make it easier to debug as well.

This program does not need loops or decisions. No input validation.

You will need to include the iomanip library for output formatting. Use three decimal places of precision.

You will also need the strings library.

You will need to use basic functions so make sure to review the C++ programming guide for CISP301 review on this topic and refer Chapter 6 of the textbook and revise Functions material on Zybook.

You will need to submit your design document (see the sample programming assignment document) and submit your code.

Program to Calculate Final Bill:

The Software Engineering Process consists of Problem Analysis, Specification, Design, Development, Documentation, Testing, Debugging, Presenting. Work is done collaboratively using appropriate tools at each step of the process.

Problem: Sam has a special offer to purchase two games from a computer game store. He may purchase one game at regular price and the second game can be selected from the rack that has 10% off. Accordingly Sam would like to purchase two computer games, gameOne and gameTwo. Sales tax is 8% of the total cost after discounts are applied. Sam is on a budget and he needs your help to select two games such that the final bill will be affordable for him. Your task is to write a program that inputs prices of two games and computes the final bill based on the above considerations to help Sam make his selection.

Problem Analysis: Given the prices of the first and the second game, the requirement is to apply the given discount to the price of the second game, add this discounted price to the price of the first game, apply the sales tax to this total to arrive at the final bill for this selection of games.

Given Specifications: Clarifying questions:

1. What are the types and ranges of numbers to be input (is this console or file i/o)

2. What are the input prompts (menu?) and output display formats

3. What is the context and environment for this program

4. Does input validation need to be done

5. If so, what is the format (ie repeat until valid answer or exit)

6. Does the program need to do this task repeatedly (menu driven with exit option for user?)

Given Design Decisions: This is a non looping program, with starting message and prompts but no menu. User is assumed to have goodwill and is expected to enter acceptable values, No input validation. User may not comply and enter all sorts of input including very small, very large integers, floating point numbers, strings and characters. Results for invalid data will be unknown. Input / Output is done via keyboard/console. No files.

Programming language C++

Formula: Final Bill = 1.08 *( costOfGame1 + 0.90*costOfGame2)

Algorithm:

Display Message for User

Prompt for cost of first game cost

Input the cost of the first game

Prompt for cost of second game

Input cost of second game

Apply discount to cost second game

Add cost of both games after discount

Apply sales tax to the above total to get the final bill

Display the final bill

Program Constraints and Framework for IPO / Design Decisions:

Indicate the variable names, types, and other design decisions

Variable name

Type

GameOnePrice

real - input

GameTwoPrice

real - input

result

real - processing

discountedPrice

real - processing

finalPrice

real - output

Test Chart: Include comments about input validation decisions and tests if any for invalid data

GameOnePrice

GameTwoPrice

FinalBill

19.99

29.99

50.74

10

20

30.24

0

0

0

-19.99

-29.99

-50.74 (unknown)

hello

world

unknown

Hierarchy Chart and Modular Design

Hello please don't understand what u mean by lengthy this is the way the professor gave us

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 17th International Conference Dasfaa 2012 Busan South Korea April 2012 Proceedings Part 1 Lncs 7238

Authors: Sang-goo Lee ,Zhiyong Peng ,Xiaofang Zhou ,Yang-Sae Moon ,Rainer Unland ,Jaesoo Yoo

2012 Edition

364229037X, 978-3642290374

More Books

Students also viewed these Databases questions

Question

MATLAB identifier validator. Enter an identifier:

Answered: 1 week ago

Question

market demograhic

Answered: 1 week ago