Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA programing Languages HW1 (5 points) 1. (1 point) A checksum is the 32-bit integer that is the sum of the Unicode characters in a

JAVA programing Languages

image text in transcribed

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 change ambae 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 jaya.math package and follow the following class outline: class RationalNumber Tester public static void main(String langs) throws EileNotFoundException private static BigRational sum(ArrayList list); private static void printList Atraxhist 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. 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 change ambae 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 jaya.math package and follow the following class outline: class RationalNumber Tester public static void main(String langs) throws EileNotFoundException private static BigRational sum(ArrayList list); private static void printList Atraxhist 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

3. Provide advice on how to help a plateaued employee.

Answered: 1 week ago