Computer project
Computer project
**Step 2**: Create a `Scanner` object named `in` to read user input.
**Step 5**: Read the next character input by the user and store it in the variable `C`.
- **Step 7.1**: Read the next input as a string and store it in `BNo`.
- **Step 7.2**: Read the next input as a string and store it in `DNo`.
- **Step 7.3**: Read the next input as a string and store it in `ONo`.
- **Step 7.4**: Read the next input as a string and store it in `HNo`.
1. **Start**
- while (`DNo` != 0) {
- `a = DNo % 2`;
- `BNo = a + BNo`;
- `DNo /= 2`;
7. **End**
1. **Start**
- while (`DNo` != 0) {
- `a = DNo % 16`;
- `HNo = a + HNo`;
- } else {
- `DNo /= 16`;
8. **End**
1. **Start**
- `a = DNo % 8`;
- `ONo = a + ONo`;
- `DNo /= 8`;
7. **End**
1. **Start**
- while (`BNo` != 0) {
- `a = BNo % 10`;
7. **End**
- Convert the character to its corresponding integer value (A=10, B=11, ..., F=15).
**Step 2**: Find the index of the decimal point in `ONo` and store it in `pointIndex`.
**Step 3**: Initialize `result` to 0 to store the decimal equivalent of the octal number.
**Step 4**: Convert the integer part of the octal number to decimal:
- Repeat the following steps for each character in `ONo` from the start to `pointIndex` (excluding `pointIndex`):
- Multiply `result` by 8.
- Add the integer value of the current character (subtract '0' from the character) to `result`.
**Step 5**: Convert the fractional part of the octal number to decimal:
- Repeat the following steps for each character in `ONo` from `pointIndex + 1` to the end of `ONo`:
- Subtract `pointIndex` from the current index `i` and compute `8` raised to this power.
- Divide the integer value of the current character (subtract '0' from the character) by this computed value.
###
Algorithm module 2
Algorithm for Constructor
Step 1: Start
Step 6: End
Step 1: Start
Step 2: Prompt the user to enter the first binary number and store it in bin1.
Step 3: Prompt the user to enter the second binary number and store it in bin2.
1. Addition
2. Subtraction
3. Multiplication
4. Division
Step 5: Prompt the user to enter their choice (1/2/3/4) and store it in choice.
Step 6: End
Step 1: Start
Step 5: Repeat the following steps until all bits in binary are processed:
Step 7: End
Step 1: Start
Step 8: End
Step 1: Start
Step 6: End
Step 1: Start
Step 6: End
Step 1: Start
Step 6: End
Step 1: Start
Step 7: End
Step 1: Start
Step 3: End
Algorithm for print Method
Step 1: Start
Step 3: End
Step 1: Start
Step 6: End
Screenshots
1
Conclusion
The project on number base conversion and a binary arithmetic calculator was successfully completed, covering
essential concepts and practical applications. The project comprised modules for converting numbers between
different bases, specifically Binary, Octal, Decimal, and Hexadecimal. These conversions were implemented using
handwritten algorithms to ensure a deep understanding of the underlying processes. Each algorithm was carefully
developed and tested, and program printouts were taken directly from the Integrated Development Environment
(IDE) to provide a clear and accurate record of the code.
Additionally, the project included modules for performing binary arithmetic operations: addition, subtraction,
multiplication, and division. These operations were chosen for their fundamental importance in computer science
and digital electronics. The binary arithmetic modules were tested extensively to verify their accuracy and efficiency.
Screenshots of the output were included at the end of the project to visually demonstrate the functionality and
correctness of each module.
Overall, the project provided valuable insights into number base conversions and binary arithmetic. By combining
theoretical knowledge with practical implementation, the project enhanced our understanding and skills in these
critical areas of computer science. The successful completion of the project also showcased the importance of
attention to detail and thorough testing in developing reliable software solutions.