Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java project Project Pentadeca. Thursday April 26 Write a Pentadeca class that encapsulates a Pentadeca number value. THE USE OF ARRAYS IS NOT PERMITTED A

Java project image text in transcribed
Project Pentadeca. Thursday April 26 Write a Pentadeca class that encapsulates a Pentadeca number value. THE USE OF ARRAYS IS NOT PERMITTED A Pentadeca number is one with 15 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E. The methods the class has are: public void readO, publie void set(String), public void set(int), public void set(Pentadeca),public Pentadeca get), public Pentadeca add(Pentadeca), public Pentadeca subtract(Pentadeca), public Pentadeca multiply (Pentadeca), public Pentadeca divide(Pentadeca), public Pentadeca add(int), public Pentadeca subtract(int), public Pentadeca multiply(int), public Pentadeca divide(int), public Pentadeca add(String), public Pentadeca subtract(String), public Pentadeca multiply(String), public Pentadeca divide(String), public boolean equals(Pentadeca), and public String toString). Write private methods to check for valid character input, remove the base p character and set the sign. Your class must consider both positive and negative values. Your class should have at least 3 constructors: a default constructor, an explicit constructor with an integer argument and an explicit constructor with a String argument. I will provide a main program as the demo. Recall the nature of numbers and their construction. 1371 is 1 103 101+7 10 In the same way 1A9is would be 1 152+10 15+15. Given the decimal number 13710 the digits can be determined using the integer operators/ and %. I 37 % 10 gives the 7, 137/ 10 gives l 313% 10 gives 3 and i 3/10 gives 1 . I %10 gives l and 1/10 gives 0. The digits base 10 of 137 are 1, 3,7. The number 13710 converted to base 5 would be l 37905 that gives 2, 137/5 gives 27, 27%) gives 2, 27/5 gives S. Sas gives 0, 515 gives l 1905 gives l and l/5 gives 0. This gives the base 5 number 1022. 13710 converted to base 15 would be 137%) 5 gives 2, 137/15 gives 9. 9%15 gives 9 and 915 gives 0. The number 13710 is therefore 9215

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

Step: 3

blur-text-image

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

What is an AI - driven chatbot?

Answered: 1 week ago

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago