Hugelnteger.java 1 public class HugeInteger { 2 3 private int[] value; 4 50 private HugeInteger (String s) { 6 parse(s); 7 } 8 90 public void parse(String s) { 10 value = new int[s.length()]; 11 for(int i = 0; i < s.length(); i++) { 12 value[i] = s.charAt(i)-'0'; 13 } 14 } 15 160 17 public String toString() { String str_value = ""; 18 19 for (int i = value.length-1; i>=0; i--) { str_value += value[i]; 20 } 21 return str_value; 22 } 23 240 25 public boolean isZero() { return true; 26 } 27 28 290 public HugeInteger add (HugeInteger num) { 30 31 } 32 return null; 330 public HugeInteger subtract (HugeInteger num) { 34 35 } 36 return null; 370 public static void main(String[] args) { 38 39 } 40 41 }
Added by Rachel R.
Close
Step 1
The class `HugeInteger` has two private instance variables: `value` (an array of integers) and `str_value` (a string representation of the integer). Show more…
Show all steps
Your feedback will help us improve your experience
Ivan Kochetkov and 91 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
John B.
Please code in Java. Write a recursive method that takes a string and returns a string where every character appears twice. For example, if the string is "HELLO", it will return "HHEELLOO". Write a program to test it.
Supreeta N.
Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with a newline. Ex: For the user input 123, 395, 25, the expected output is: Enter a number (<100): Enter a number (<100): Enter a number (<100): Your number < 100 is: 25 Edit with the following code: import java.util.Scanner; public class NumberPrompt { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); int userInput; do { System.out.println("Enter a number (<100): "); userInput = scnr.nextInt(); } while (userInput >= 100); System.out.println("Your number < 100 is: " + userInput); } }
Willis J.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD