HW1 (5 points) 1. (1 point) A checksum is the 32-bit integer that is the sum of the Unicode characters in a file (you can get the integer sum of the Unicode characters in a string by computing the sum...

1 answer below »
Java Script


HW1 (5 points) 1. (1 point) A checksum is the 32-bit integer that is the sum of the Unicode characters in a file (you can get the integer sum of the Unicode characters in a string by computing the sum of the Unicode characters of each character using the function charAt()). Two identical files have the same checksum. Write a program to compute the checksum of a file that is supplied as a command-line argument. 2. (1.5 points) A combination lock has the following basic properties: the combination (a sequence of three numbers) is hidden; the lock can be opened by providing the combination; and the combination can be changed, but only by someone who knows the current combination. Design a class with public methods open and changeCombo and private data fields that store the combination. The combination should be set in the constructor. 3. (1.5 points) Write a program that reads a data file containing rational numbers, one per line, stores the numbers in an ArrayList, removes any duplicates, and then outputs the sum. Note: use BigRational from java.math package and follow the following class outline: class RationalNumberTester { public static void main (String [] args) throws FileNotFoundException private static BigRational sum(ArrayList list); private static void printList(ArrayList list); private static boolean listContains(ArrayList list, BigRational item); } 4. (1 point) Add a Square class into the Shape hierarchy, and have it implement Comparable Note: A square has only one side as data field; the class should have methods to compute the area and perimeter. Submit the .java file for each question or the links to your code in an online java compiler such as onlinegdb.com or others.
Answered 1 days AfterFeb 09, 2021

Answer To: HW1 (5 points) 1. (1 point) A checksum is the 32-bit integer that is the sum of the Unicode...

Aditya answered on Feb 11 2021
161 Votes
public class Square implements Comparable{
    private int side;
    
    public Square()
    {
        

    }
    
    public Square(int side)
    {
        this.side = side;
    }
    public int getSide() {
        return side;
    }
    public void setSide(int side) {
        this.side = side;
    }
    
    public int getArea()...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here