Assignment5 - /* * UserOperations includes mathematical...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/** * UserOperations includes mathematical operations +, -, *, /, % and the logical operations: ==, >, and <. * The current operation may be set and will perform on entered operands * * @author Dung Nguyen * @version September 25, 2009 * Assignment: 05 * Due date: Setptember 25, 2009 * * */ public class UserOperations { //the currently selected operation private char selection; //The number of times that add operation is sellected private int addCount; //The number of times that equivalent operation is sellected private int equalCount; //The total number of all the operations the user has performed. private int total; /** * Constructor set 0 to the values of addCount, equalCount and total * The initial operation is add */ public UserOperations() { // initialise instance variables addCount = 0; equalCount = 0; total = 0; //Call make Selection will increase the number of selection of add operation makeSelection( 'a'); } /** * Constructor initializes the selection property */ public UserOperations(char operation) { // initialise instance variables addCount = 0; equalCount = 0; total = 0; //Call make Selection to check the validity of passed values makeSelection( operation); } /** * Constructor initializes the values of properties as passed values
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
*/ public UserOperations(int addCount, int equalCount, char selection, int total) { // initialise instance variables this.addCount = addCount; this.equalCount = equalCount; this.selection = selection; this.total = total; } /** * Get the count of the add operations the user has performed. * * @return count of add operations */ public int getAddCount() { return addCount; } /** * Get the count of the equal operations the user has performed. * * @return count of equal operations */ public int getEqualCount() { return equalCount; } /** *Get the currently selected operation * * @return Currently selected operation */ public int getSelection()
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

Assignment5 - /* * UserOperations includes mathematical...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online