From ae2b8392e22a93c43fa804aa0f68e13d21cd4b1e Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Fri, 4 Oct 2019 10:46:22 -0500 Subject: Lab is done but it looks not good --- csci1913/Java/Driver.java | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'csci1913') diff --git a/csci1913/Java/Driver.java b/csci1913/Java/Driver.java index 2f96b1b..de3f2f6 100644 --- a/csci1913/Java/Driver.java +++ b/csci1913/Java/Driver.java @@ -4,7 +4,39 @@ // These tests are worth a total of 25 points. class Zillion { - + private int s; + private int[] number; + public Zillion(int size) { + number = new int[size]; + s = size; + } + public void increment(){ + int n = 0; + boolean isCorrect = false; + while (isCorrect==false) { + number[n]+=1; + if (number[n] >= 10) { + number[n]=0; + if (n<(s-1)) { + n+=1; + } + else { + isCorrect = true; + } + } + else { + isCorrect=true; + } + } + + } + public String toString(){ + String test = ""; + for (int n=(s-1); n>=0; n-=1) { + test+=number[n]; + } + return test; + } } class Driver -- cgit v1.2.3