Project #1 - Fraction Calculator

Similar documents
Lab 1 - Calculator. K&R All of Chapter 1, 7.4, and Appendix B1.2

Municode Website Instructions

Adverse Action Letters

Relius Documents ASP Checklist Entry

Lab 1 - Calculator. K&R All of Chapter 1, 7.4, and Appendix B1.2 Iterative Code Design handout Style Guidelines handout

InformationNOW Letters

REFWORKS: STEP-BY-STEP HURST LIBRARY NORTHWEST UNIVERSITY

COP2800 Homework #3 Assignment Spring 2013

UiPath Automation. Walkthrough. Walkthrough Calculate Client Security Hash

UiPath Automation. Walkthrough. Walkthrough Calculate Client Security Hash

Test Pilot User Guide

CS1150 Principles of Computer Science Introduction (Part II)

InformationNOW Letters

Integrating QuickBooks with TimePro

InformationNOW Letters

INSTALLING CCRQINVOICE

Grade 4 Mathematics Item Specification C1 TJ

ClassFlow Administrator User Guide

August 22, 2006 IPRO Tech Client Services Tip of the Day. Concordance and IPRO Camera Button / Backwards DB Link Setup

LAB 7 (June 29/July 4) Structures, Stream I/O, Self-referential structures (Linked list) in C

Lab 0: Compiling, Running, and Debugging

CSCI L Topics in Computing Fall 2018 Web Page Project 50 points

My Performance Management User Guide

Programming Project: Building a Web Server

OASIS SUBMISSIONS FOR FLORIDA: SYSTEM FUNCTIONS

Network Rail ARMS - Asbestos Risk Management System. Training Guide for use of the Import Survey Template

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

These tasks can now be performed by a special program called FTP clients.

WebEx Web Conferencing Quick Start Guide

Summary. Server environment: Subversion 1.4.6

Access 2000 Queries Tips & Techniques

Using CppSim to Generate Neural Network Modules in Simulink using the simulink_neural_net_gen command

Reading and writing data in files

Exporting and Importing the Blackboard Vista Grade Book

Guide for Referees 2018

TUTORIAL --- Learning About Your efolio Space

Uploading Files with Multiple Loans

Eastern Mediterranean University School of Computing and Technology Information Technology Lecture2 Functions

Proper Document Usage and Document Distribution. TIP! How to Use the Guide. Managing the News Page

Copy your Course: Export and Import

Ascii Art Capstone project in C

Using the Swiftpage Connect List Manager

Graduate Application Review Process Documentation

Exercise 4: Working with tabular data Exploring infant mortality in the 1900s

STIDistrict AL Rollover Procedures

Outlook Web Application (OWA) Basic Training

Secure File Transfer Protocol (SFTP) Interface for Data Intake User Guide

Interfacing to MATLAB. You can download the interface developed in this tutorial. It exists as a collection of 3 MATLAB files.

PowerTeacher Classroom Management Tool Quick Reference Card

Repstor custodian. On Premise Pre-Requisites. Document Version 1.1 January 2017

html o Choose: Java SE Development Kit 8u45

Getting Started with the Web Designer Suite

Guidelines for Installing HI 1734-WS Faceplates

CS1150 Principles of Computer Science Midterm Review

State Assessment Program Indiana Released Items Repository Quick Guide

Courseware Setup. Hardware Requirements. Software Requirements. Prerequisite Skills

Importing data. Import file format

Extended Vendors lets you: Maintain vendors across multiple Sage 300 companies using the Copy Vendors functionality. o

Automatic imposition version 5

1 Getting and Extracting the Upgrader

Your Project Plan and Smartsheet

User Guide. Document Version: 1.0. Solution Version:

CREATING A DONOR ACCOUNT

InformationNOW Elementary Scheduling

1 Getting and Extracting the Upgrader

Element Creator for Enterprise Architect

Using the Swiftpage Connect List Manager

I - EDocman Installation EDocman component EDocman Categories module EDocman Documents Module...2

ME Week 5 Project 2 ilogic Part 1

1 Getting and Extracting the Upgrader

Arius 3.0. Release Notes and Installation Instructions. Milliman, Inc Peachtree Road, NE Suite 1900 Atlanta, GA USA

Trimble Survey GNSS Firmware Version 4.81 (July 2013)

Concentrix University Learning Portal FAQ Document

Enabling Your Personal Web Page on the SacLink

C++ Reference Material Programming Style Conventions

Chapter 2 Basic Operations

istartsmart 3.5 Upgrade - Installation Instructions

BMC Remedyforce Integration with Remote Support

Whitepaper. Migrating External Specs to AutoCAD Plant 3D. Set Up the Required Folder Structure. Migrating External Specs to AutoCAD Plant 3D

$ARCSIGHT_HOME/current/user/agent/map. The files are named in sequential order such as:

Interstate Passport Services PassportVerify Request File Formatting and Submission Guide

InformationNOW Standardized Tests

How to Mass Assign Student Course Requests

Introduction to Adobe Premiere Pro for Journalists:

Guide to getting started in J2ME for the Motorola A780 phone

PAY EQUITY HEARINGS TRIBUNAL. Filing Guide. A Guide to Preparing and Filing Forms and Submissions with the Pay Equity Hearings Tribunal

WorldShip PRE-INSTALLATION INSTRUCTIONS: INSTALLATION INSTRUCTIONS: Window (if available) Install on a Single or Workgroup Workstation

What s New in Banner 9 Admin Pages: Differences from Banner 8 INB Forms

IAB MRAID 2 TEST AD: RESIZE WITH ERRORS AD. Resize with Errors Ad. URL for this Creative. Goal of Ad. This Creative Tests:

Copyrights and Trademarks

Single File Upload Guide

InformationNOW Elementary Scheduling

Code should compile and demonstrate proper programming style; e.g., whitespace, identifier naming, etc.

Date: October User guide. Integration through ONVIF driver. Partner Self-test. Prepared By: Devices & Integrations Team, Milestone Systems

Manual for installation and usage of the module Secure-Connect

ROCK-POND REPORTING 2.1

Dashboard Extension for Enterprise Architect

Knowledgeware Rule-based Clash

Scroll down to New and another menu will appear. Select Folder and a new

Element Creator for Enterprise Architect

Transcription:

AP Cmputer Science Liberty High Schl Prject #1 - Fractin Calculatr Students will implement a basic calculatr that handles fractins. 1. Required Behavir and Grading Scheme (100 pints ttal) Criteria Pints Descriptin Parses input crrectly 10 The prgram shuld read in fractin equatins and print the results in a cntinuus lp until the user types "quit". Input will be mixed fractins, prper fractins, imprper fractins r integers. Fr these pints, prper and imprper fractins and integers must be handled. Input will be separated by spaces exactly ne space between each fractin and peratr. Additin 5 Prgram handles the + peratr. Subtractin 5 Prgram handles the - peratr. Multiplicatin 5 Prgram handles the * peratr. Divisin 5 Prgram handles the / peratr. Result reductin 15 The utput needs t be in standard mixed fractins, prperly reduced (i.e. 1/2 instead f 2/4, 1_1/4 instead f 5/4) Mixed fractin input 10 Prgram handles mixed fractins. The integer and fractin parts f a mixed fractin will be separated by an underscre. Mixed fractin utput 15 Output will be in mixed fractin frmat. Handles negatives 10 Negatives are allwed the negative sign shuld g immediately befre the whle part f the number (with n space in between). Checkpint met 5 per checkpint (15 ttal) Functinality required fr each checkpint must be met t earn these pints. Cmments/style 5 All majr parts f the prgram cmmented. Crrect use f identifier cnventins. Cde indented crrectly and spaced ut apprpriately. 2. Specificatins Input: Input will be in the frm f a value, fllwed by an arithmetic peratr, and then anther value. Values and peratrs will be separated by a single space. Values will cntain n spaces. Input values may be in the frm f mixed fractins, prper fractins, imprper fractins r integers. The integer and fractin parts f a mixed fractin will be separated by an

underscre (_) (e.g., 1_3/4 is ne and three furths t distinguish it frm 13/4 which is thirteen furths). The calculatr will supprt the 4 basic arithmetic peratins: add (+), subtract (-), multiply (*), and divide (/). The prgram shuld accept an equatin, calculate the result in the prper frm, print it t screen, and then be ready t accept anther equatin. The user shuld be able t exit the prgram by entering the cmmand quit" instead f an equatin. See the examples sectin belw fr clarificatin. Output The utput value must always be reduced and never imprper (it may be an integer, fractin, r mixed fractin, as apprpriate). Example: a result f 10/4 shuld be printed t the screen as 2_1/2). See the examples sectin belw fr clarificatin. Examples Input Output Ntes 1/4 + 1_1/2 1_3/4 8/4 + 2 4 Input may be an imprper fractin. -1 * -1/2 1/2-11/17 + -1/17-12/17 0 * 25_462/543 0 Remember t check fr brder/special cases. Cde Organizatin Yu must rganize yur cde in the fllwing way t receive credit fr yur prject. If yu deviate frm this, yur unit tests will fail, and significant pints will be deducted frm yur grade. 1) Yu must cmplete the implementatin fr the fllwing methd, inside yur FracCalc.java file: public static String prduceanswer(string input) This methd receives a single line f user input as its parameter (fr example, 3_1/2 + 1/4"), and returns the answer (fr example, 3_3/4 ). This methd des nt print anything! 2) Yur main() methd must use a Scanner t receive input frm the user, call prduceanswer with that input, and then print the answer that was returned by prduceanswer. Yur main methd eventually is respnsible fr repeatedly reading input frm the user, calling prduceanswer(), printing the result, and ending nce the user types quit, althugh in the first checkpint nly ne line f input needs t be read, with a single respnse printed t the cnsle. 3) Yur cde must pass the unit tests fr the checkpint yu re submitting. If all the tests fail, that is a sign yur cde is rganized incrrectly. Fix befre submitting t us. 3. Additinal Cmments N numbers in the fractin will exceed the limits f a Java int (between -2,147,483,648 and 2,147,483,647) after they are multiplied which means the input will be between -32,768 and 32767. Use the included unit tests (described belw) t thrughly check yur prgram, well beynd the abve examples. We use these same tests t grade yur prject.

4. Checkpints Checkpint 1 Parsing ne line f input 2 Multiple lines f input, parsing fractins Criteria Yur main() methd creates a Scanner, reads ne line f input, and passes that input t prduceanswer. prduceanswer breaks up that line f input int three Strings: the first perand (fractin), the peratr (+ - * /), and the secnd perand (fractin). Each f these Strings shuld be stred in variables inside prduceanswer. prduceanswer returns the secnd perand. Fr example, prduceanswer( 1_2/3 + 4_5/6 ) returns 4_5/6. main() prints the result returned by prduceanswer Yur main() methd nw accepts input frm the user multiple times (until the user types quit ) Fr each line f input, main calls prduceanswer() and prints the returned result This time, prduceanswer must further parse each perand int 3 integer variables, ne each fr the numeratr, denminatr, and whle prtin (fr mixed fractins r integers). Nte that there are cases where nt all 3 f these cmpnents are present (see belw). prduceanswer nw must demnstrate yu have parsed fractins prperly by returning a string that describes each cmpnent f the secnd perand: the whle number prtin (r 0 if nt specified), the numeratr (r 0 if nt specified), and the denminatr (r 1 if nt specified). Examples: prduceanswer("5_3/4-6_5/8") returns "whle:6 numeratr:5 denminatr:8" prduceanswer("-3/7-20") returns "whle:20 numeratr:0 denminatr:1" prduceanswer( -32-27/21 ) returns "whle:0 numeratr:27 denminatr:21" Nte: yur spelling, casing, and spacing must match these examples exactly, r the tests will fail and yu will nt receive full credit. Nte: prduceanswer must parse bth perands even thugh the returned String describes nly the secnd ne 3 Evaluatin prduceanswer must nw evaluate the frmula it is given (perfrming additin, subtractin, multiplicatin, and divisin, based n the peratr specified), and return the actual answer f that calculatin (instead f just returning the secnd perand). The answer need nt be reduced, and need nt be a mixed fractin. But it must be crrect. All kinds f input values the user might enter must be accepted, including simple fractins, imprper fractins, mixed fractins, and integers. Final All requirements cmplete Fully functinal +, -, *, r / including imprper, mixed fractins All answers must be reduced All tests shuld pass 5. What t hand in at each checkpint: 1. Checked ff during class r electrnic versin f yur prgram. 6. Extra Credit: Criteria Multiple Operatins Pssible Descriptin pints 5 Handle mre than ne peratin (e.g. 1 + 1 + 1-1/2)

Precedence 7.5 Crrectly mainlining the rder f peratins with mre than tw inputs (e.g. 1-2 * 4 returning -7 instead f -4) Input Errr Handling 2.5 Handling bad input gracefully (e.g. 1 + + 1/2 des nt cause the prgram t crash) Additinal extra credit fr ther advanced behavir based n cmplexity and cmpleteness. See Mr. Bradley with yur specificatin prir t implementatin f extra behavir. Maximum extra credit available 15 pints. Getting Started These instructins will result in a brand new prject, which includes the Unit Testing infrastructure that will make it easy fr yu verify yur fractinal calculatr. 1. Open Eclipse 2. Add Git t yur Eclipse Envirnment. (Vide here.) a. Add the Git tlbar buttns t the Tl Bar. i. Windw -> Perspective -> Custmize Perspective ii. Select the Actin Set Availability tab iii. Check Git iv. Select the Tl Bar Visibility tab v. Check Git. vi. Press OK. b. Add Git Repsitries t yur Package Explrer windw i. In the Package Explrer, right-click Shw In ->Git Repsitries c. Add the Git Staging Windw i. Windw ->Shw view -> Other ii. Select Git -> Git Staging. iii. Press Open. 3. If yu already have a prject in yur wrkspace named FracCalc, yu will need t rename it s that it des nt cllide with the prject yu are nw imprting. Yu can rename a prject by rightclicking the prject in the Package Explrer windw, chsing Refactr, Rename, and then typing in the new name. 4. Clne the Git Repsitry fr FracCalc.

a) Click n Clne a Git Repsitry b) Cpy the Repsitry URL frm GitHub Classrm. a. Open a brwser and navigate t yur GitHub Classrm. b. Yur URL will be different than this, but this is where yu get the URL frm: c) Paste the URL int the Clne Git Repsitry. 5. When the Branch Selectin windw appears, press Next. This has nw made a cpy f the repsitry fr the starter prject n the lcal disk, hwever the prject is still nt in Package Explrer. 6. Get the Repsitry t appear in Package Explrer.

a. Right-click in the Git Repsitries Windw n the FracCalc prject and select Imprt Prjects i. Uncheck the FracCalc flder and keep the FracCalc\FracCalc flder b. Press Finish c. Yu shuld have a prject named FracCalc. Yu will d yur wrk in FracCalc.java. 7. T run all tests, pen FracCalcTestALL.java, and click the green play buttn n the tlbar.