Part 1: Data Representation

  • Learn how to convert unsigned 8-bit binary integers to decimal, and vice-versa. Learn how to convert 16-bit hexadecimal integers to decimal, and vice-versa.
  • Learn how to do hexadecimal addition and subtraction.

Tasks:

Question: What is the decimal representation of each of the following unsigned binary integers?

  • 11111000
  • 11001010
  • 11110000

Question: How many bits are contained in each of the following data types?

  • word
  • doubleword
  • quadword

Question: What is the minimum number of binary bits needed to represent each of the following unsigned decimal integers?

  • 65
  • 256
  • 32768

Question: What is the hexadecimal representation of each of the following binary numbers?

  • 1100 1111 0101 0111
  • 0101 1100 1010 1101
  • 1001 0011 1110 1011

Question: What is the unsigned decimal representation of each hexadecimal integer?

  • 3A
  • 1BF
  • 4096

Part 2: Students and Courses, Part 1

You may use an IDE or a text editor, but I will test this by compiling and running from the command line so be sure to test it that way. (No packages allowed) The program will not compile and run at the command line if you include any package statements.

Save this program, for a future assignment

Here are the steps.

(1) Create a Student class containing an ID, a last name, and a list of course names such as "COP2210" or "COP2250". This should not be a string of multiple courses. The ID should be an integer which is printed with leading zeros.

(2) Create a class named StudentTest that contains a List of students. Do not use the list provided here. In the class constructor, create 15 students and add them to the list. Each student's ID must be different. Each student you add to the list must contain 2-4 different course names. At least one should have two course names and at least one should have four course names. Make sure the students do not all have the same courses, although there should be some overlap (see the sample below). The student names must be inserted into the list in random order (not sorted).

(3) Sort the list in ascending order by student last name and display the list. For each student, display the ID with leading zeros, last name, and list of courses on a single line. Here is sample output. Note how the tab character is inserted after the name to line up the next column containing courses. Be sure there is no trailing comma at the end of the list of courses.

0008, Alvarez COP2250, COP3250, COP4250
0002, Chong COP1210, COP3337, COP3530
0026, Fujioka COP2250, COP3250, COP4250
0032, Johnson COP1210, COP3337, COP3530
0010, Kim COP1210, COP3337, COP3530
0027, O'Malley COP2250, COP3250, COP4250
0044, Pierrot ENC1105, ENC3250, REL2210
0013, Ramirez ENC1105, ENC3250, REL 2210
0001, Smith COP 2250, COP3250, COP4250
0011, Wong ENC1105, ENC3250, REL 2210
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.