CSCI 1301: Introduction to Computing and Programming Summer 2015 Project 1: Credit Card Pay Off



Similar documents
Decision Logic: if, if else, switch, Boolean conditions and variables

12.6 Logarithmic and Exponential Equations PREPARING FOR THIS SECTION Before getting started, review the following:

Measures of Error: for exact x and approximation x Absolute error e = x x. Relative error r = (x x )/x.

Assignment 4 CPSC 217 L02 Purpose. Important Note. Data visualization

Solving Exponential Equations

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

ROUND(cell or formula, 2)

Assignment 2: Option Pricing and the Black-Scholes formula The University of British Columbia Science One CS Instructor: Michael Gelbart

Precalculus Orientation and FAQ

Introduction to Java Applications Pearson Education, Inc. All rights reserved.

FEEG Applied Programming 5 - Tutorial Session

Programmierpraktikum

Chapter 2: Elements of Java

CS 2302 Data Structures Spring 2015

Math 120 Basic finance percent problems from prior courses (amount = % X base)

UNIT AUTHOR: Elizabeth Hume, Colonial Heights High School, Colonial Heights City Schools

MATH 205 STATISTICAL METHODS

TESTING CENTER SARAS USER MANUAL

DNA Data and Program Representation. Alexandre David

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

MATH 205 STATISTICAL METHODS

Section 1. Logarithms

Memory Management Simulation Interactive Lab

Review of Scientific Notation and Significant Figures

BRAZOSPORT COLLEGE LAKE JACKSON, TEXAS SYLLABUS ITSE 1432 INTRODUCTION TO VISUAL BASIC.NET PROGRAMMING

Introduction to Programming II Winter, 2014 Assignment 2

Solving Compound Interest Problems

Chapter 2. Binary Values and Number Systems

For month 1, we can compute the minimum monthly payment by taking 2% of the balance:

6.1. Example: A Tip Calculator 6-1

Getting Started with Excel Table of Contents

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

CHAPTER 5 Round-off errors

NORTH CENTRAL TEXAS COLLEGE COURSE SYLLABUS

SYLLABUS INSTRUCTOR NAME: DONNA MCGOVERN INSTRUCTOR

Number Systems and Radix Conversion

CS 241 Data Organization Coding Standards

The course assumes successful completion of CSCI E-50a and CSCI E-50b, i.e. at least two semesters of programming, with a grade of C- or better.

e-service On-line Bill Payment User Guide

Sequences. A sequence is a list of numbers, or a pattern, which obeys a rule.

MATH 143 Pre-calculus Algebra and Analytic Geometry

MATH : Intermediate Algebra

1001ICT Introduction To Programming Lecture Notes

Getting Started with MasteringPhysics

Introduction. Mathematics 41P Precalculus: First Semester

JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4

Chapter 3. Input and output. 3.1 The System class

COMSC 100 Programming Exercises, For SP15

Math 131 College Algebra Fall 2015

Master of Science (MS) in Computer Science

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

Sources: On the Web: Slides will be available on:

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

Linear Equations and Inequalities

Binary Number System. 16. Binary Numbers. Base 10 digits: Base 2 digits: 0 1

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

CSCI 528: OBJECT ORIENTED PROGRAMMING, Fall 2015

Finance 197. Simple One-time Interest

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables

A Short Guide to Significant Figures

Prentice Hall: Middle School Math, Course Correlated to: New York Mathematics Learning Standards (Intermediate)

3.2 The Factor Theorem and The Remainder Theorem

Project 4 DB A Simple database program

Logarithmic and Exponential Equations

MATHEMATICS OF FINANCE AND INVESTMENT

MBA Jump Start Program

Introduction to Python

YOU CAN COUNT ON NUMBER LINES

FTP client Selection and Programming

8 Square matrices continued: Determinants

Chapter 2. println Versus print. Formatting Output withprintf. System.out.println for console output. console output. Console Input and Output

Getting Started with

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Repetition Using the End of File Condition

MATH Advanced Business Mathematics

Computer Science 1015F ~ 2010 ~ Notes to Students

Preface of Excel Guide

Solution for Homework 2

Introduction to Applied Behavior Analysis SPE 439 Spring

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science

Developmental Mathematics Curriculum

Math 1314 Online Syllabus. College Algebra

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

Teaching Pre-Algebra in PowerPoint

CSI 333 Lecture 1 Number Systems

Fractions and Linear Equations

Communication Skills for Engineering Students Sample Course Outline

Acing Math (One Deck At A Time!): A Collection of Math Games. Table of Contents

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Level 3 Develop software using Java (7266/ )

Unit 7 The Number System: Multiplying and Dividing Integers

Numerical Matrix Analysis

The Credit Card Dilemma

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0

Goal: Practice writing pseudocode and understand how pseudocode translates to real code.

AUSTIN COMMUNITY COLLEGE DEPARTMENT OF COMPUTER STUDIES AND ADVANCED TECHNOLOGY

CS 106 Introduction to Computer Science I

Transcription:

CSCI 1301: Introduction to Computing and Programming Summer 2015 Project 1: Credit Card Pay Off Introduction This project will allow you to apply your knowledge of variables, assignments, expressions, type casting, input, output, and basic algorithm design. The program can be completed using variable assignment statements as well as input and output statements. You are free, however, to use any other features of Java. You will write a Java application to compute and display the number of months needed to pay off credit card debt. Your program will prompt the user for the following three things: the principal, which is the amount of money owed on the credit card; the annual interest rate; the monthly payment, the amount the user plans to pay the credit card company each month. Based on these inputs, the program will compute the number of months required to pay the debt. It will also compute the total amount paid to the credit card company after all payments are made, the total the amount of interest paid, and the overpayment. The number of months needed to pay off the debt can be calculated using the following formula. ln monthlypayment ln monthlypayment annualinterestrate principal 1200.0 ln annualinterestrate + 1.0 1200.0 In the formula, ln(x) is the natural logarithm of a real number x > 0. The total amount paid to the credit card company is the ceiling of the number of months needed to pay off the debt multiplied by the monthly payment. The total interest paid is simply the principal amount (which is provided by the user) subtracted from the total amount paid to the credit card company. The overpayment is the amount overpaid to the credit card company, which is an algorithm you ll have to figure out. Details about these computations are given in the Program Requirements section. The following is a sample run, and the input (5000.00, 15.0, 100.00 shown in red for demonstration purposes only) and output of your submitted program should be formatted the same way when run in Eclipse s console or on a command line. Additional sample runs are included at the end of this document. 5000.00 15.0 100.00 79 $7900.00 $2900.00 $4.43

Program Requirements The instructions below must be followed in order for full credit to be awarded. Following the instructions is a vital part to this and all programming projects. 1. The name of the program file must be CreditCardPayOff.java. 2. The class name in the file must be CreditCardPayOff (in Java, the class name and.java file name must match). 3. The program must read inputs and display the results in exactly as indicated in the examples. 4. The annual interest rate should be entered as a percent as shown in the examples. 5. The Months Needed To Pay Off must be stored with two different variables. One variable should store the raw value as a double computed by the formula above. The other variable should be stored and written to output as a 32-bit integer, and it should contain the ceiling of the raw value (the smallest integer greater than or equal to it). For instance, the integer ceiling of 9.2 is 10. 6. All other numeric variables must be double data types. 7. You must figure out the algorithm to compute the overpayment based on the examples given at the end of this project. Hint: It uses both the floating point and integer values of The Months Needed To Pay Off. Write its algorithm in pseudocode in the comments of your project directly above the line(s) of source code that computes the overpayment. 8. The Total Amount Paid, Total Interest Paid, and Overpayment output must be formatted like units of currency. They must have a $ in front of their values, and their values must show only two digits after the decimal point. An example of formatting output can be done with the printf method, and examples of this are shown in pp. 101-102 in the 6 th edition of the course textbook. You can also round to two decimal places by using mathematical operations (divide, type casting, and multiply). 9. You must include the following comment at the top of the program file. Copy and agree to the entirety of the text below, and fill in the class name of your.java file, your name, submission date, and the program s purpose. /* * [Class name here].java * Author: [Your name here] * Submission Date: [Submission date here] * * Purpose: A brief paragraph description of the * program. What does it do? * * Statement of Academic Honesty: * * The following code represents my own work. I have neither * received nor given inappropriate assistance. I have not copied * or modified code from any source other than the course webpage * or the course textbook. I recognize that any unauthorized CSCI 1301: Project 1 Page 2

* assistance or plagiarism will be handled in accordance with * the University of Georgia's Academic Honesty Policy and the * policies of this course. I recognize that my work is based * on an assignment created by the Department of Computer * Science at the University of Georgia. Any publishing * or posting of source code for this project is strictly * prohibited unless you have written consent from the Department * of Computer Science at the University of Georgia. */ In the future, every Java file of every project you submit must have a comment such as this. Otherwise, points will be deducted from your project. When writing your program, you may safely assume that all input to the program is valid. That is, you do not need to write code to handle erroneous or ill-formed data entered by the user. If your program returns NaN, it is likely that you have entered numbers that will never result in paying off the credit card debt. For example, if the debt is $1,000,000 and you pay $1 per month with a high interest rate, you will never pay off your debt. In this case, the program will output NaN. This is not considered valid input. Hints Aligning the input prompts and the output values will require the use of escape sequences. It is recommended that you use tabs ( \t ) rather than spaces. Java's JDK provides a class Math which is always available which contains a method called ceil which will return the ceiling of a given number passed as an argument. The returned value will be returned as a double. For example, double a = Math.ceil(3.4576); // Math.ceil returns 4.00 double b = Math.ceil(4); // Math.ceil returns 4.00 The JDK's Math class also contains a method called log, which returns the natural logarithm, ln, of its argument. Again, the returned value has type double. For example, double c = Math.log(12.7); Project Submission //Math.log returns //the ln(12.7) 2.54160199 Submit the file CreditCardPayOff.java and only that file via elc-new. Project Grading All projects are graded out of a possible 100 points. Programs can be submitted up to 48 hours late, but late programs will lose 25 points on the first day late (0 to 24 hours after its deadline) and 50 points on the second day late (24 to 48 hours after its deadline). Programs not submitted within 48 hours after the deadline will receive a grade of 0. Programs that do not compile will CSCI 1301: Project 1 Page 3

receive a grade of zero. You must make absolutely certain your program compiles before submitting, and you must thoroughly test your program with many different inputs to verify that it is working correctly. This project will be graded for both correctness and style: Style [20pts] 5 points for including the comment described in item 9 of the requirements. 5 points for helpful comments. 5 points for using well-named variables, conforming to Java naming conventions, and using the specified class and filenames. 5 points for proper and consistent code indentation and readability. Correctness [80pts] Examples 10 points for input formatting 10 points for output formatting 60 points for correct output on various test cases. You can safely assume that test cases will have valid inputs. Test cases resulting in NaN are not valid inputs. Also, you can safely assume that we will test with test cases other than the few found below. Your program should work correctly on the examples below. It should prompt the user for information (shown in red for demonstration purposes only), and produce calculated values matching those shown below. All input and output should be formatted as shown when run in Eclipse s console or in the command line. 5000.00 15.0 100.00 79 $7900.00 $2900.00 $4.43 10250.50 17.25 550.75 22 $12116.50 $1866.00 $102.02 CSCI 1301: Project 1 Page 4

CSCI 1301: Project 1 Page 5

3557.27 5.74 275.99 14 $3863.86 $306.59 $183.43 8556.74 29.95 316.78 46 $14571.88 $6015.14 $162.25 CSCI 1301: Project 1 Page 6