Ch 1. Number Systems
Ch 1. Programming Exercises
Exercise 1: Data Type Identifier
The objective of this exercise is to practice identifying and working with different mathematical data types. Your task is to write a program (using pseudocode or a programming language of your choice) that takes user input and determines whether it is an integer, floating-point number, Boolean, or character. Display the detected type and an example of how it might be used in a real-world application.
Exercise 2: Binary and Hexadecimal Converter
The objective of this exercise is to practice converting between number systems. Your task is to create a program (using pseudocode or a programming language of your choice) that accepts a decimal number from the user and outputs its binary and hexadecimal equivalents. Include input validation to ensure the number is non-negative.
Exercise 3: Binary Arithmetic Simulator
The objective of this exercise is to reinforce binary addition and subtraction. Your task is to write a program (using pseudocode or a programming language of your choice) that takes two binary numbers as input (as strings), performs binary addition and subtraction, and displays the results in both binary and decimal formats.
Exercise 4: Hexadecimal Addition Tool
The objective of this exercise is to apply hexadecimal arithmetic. Your task is to create a program (using pseudocode or a programming language of your choice) that accepts two hexadecimal numbers from the user, adds them, and displays the result in both hexadecimal and decimal. Include comments explaining each step of the conversion and addition process.
Exercise 5: Smart Device Data Logger
The objective of this exercise is to combine data types and number systems in a real-world context. Your task is to simulate a smart device (using pseudocode or a programming language of your choice) that logs the following data: device ID (hex), temperature (float), status (Boolean), and timestamp (binary). Store each log entry as a tuple and print a human-readable summary of the data.