Posted on

Create a Java Program called EX1C in Eclipse and add the project to your repo The java file

Create a Java Program, called “EX1C”, in Eclipse and add the project to your repo. The java file should thus be “EX1C.java” and it should contain all of your code. Make sure that your repo contains a complete eclipse java project, rather than just the java file. Your program should have two methods: “main()” and “compute()”. The compute method is a 0-arg method, and it should return a Double. It should also be public.Have main() call compute() and then print “COMP1050-” followed by your last nam

Read More

Posted on

CS3443 Simulating 4bit MIPS ALU You are to write a gate level simulator for a simple 4bit ALU

CS3443: Simulating 4-bit MIPS ALU You are to write a gate level simulator for a simple 4-bit ALU with the following operations: - AND - OR - ADD (1-bit full adder) - SUB - SLT - Overflows/zero Detection All the operations and architectures to simulate are based on what we have studied in class. So, we'll review them before simulation. Note that the underlying number system is two's complement. You may use any language of your choice to write the simulator. 1) Input format (to be input from the command line): Opcode (in string) operand1 operand2 (both operands in integer): e.g., ADD 11110001, SUB 11110001, AND 11110001, OR 11110001, SLT 1111 0001 2) Output format (to be displayed on the screen): - For ADD, SUB, AND, OR: Opcode: 4-bit result, 1-bit overflow-detection, 1-bit zero-detection ADD: 0000,1,1 SUB: 1110,0,0 AND: 0001,0,0 OR: 1111,0,0 - For SLT: 1-bit result (0 or 1) SLT: 0001

CS3443: Simulating 4-bit MIPS ALU You are to write a gate level simulator for a simple 4-bit ALU with the following operations: – AND – OR – ADD (1-bit full adder) – SUB – SLT – Overflows/zero Detection All the operations and architectures to simulate are based on what we have studied in class. So, we’ll review them before simulation. Note that the underlying number system is two’s complement. You may use any language of your choice to write the simulator. 1) Input format (to be input from the c

Read More

Posted on

begintabularll hline multicolumn1c Income multicolumn1c Tax for Single

Write a program in Thonny that will calculate income tax owed given wages, taxable interest, unemployment compensation, status (single or married) and taxes withheld. Taxpayers are only allowed to use this short form if adjusted gross income (AGI) is less than $120,000. Dollar amounts are displayed as integers with comma separators. For example, print(f"Deduction: ${deduction:,}").Hint – it will be one program but build this program in steps.Step 1 – Get Input - You will input wages, taxable interest, unemployement compensation, status (1=single and 2=married) and taxes withheld as integers.Step 2 – Calculate AGI - You are to calculate the adjusted gross income (AGI). It is calculated as wages + interest + unemployement. Output error message if the AGI is above $120,000 and the program stops with no additional output.Step 3 - Identify Deduction Amt - deduction amount based on status: (1) Single=$12,000 or (2) Married=$24,000. Set status to 1 if not input as 1 or 2. Calculate taxable income (AGI - deduction). Set taxable income to zero if negative.Step 4 – Calculate Tax Amount - Calculate tax amount based on exemption and taxable income (see tables below). Tax amount should be stored as a double and rounded to the nearest whole number using round().Step 5 – Calculate Tax Due or Refund - Calculate amount of tax due (tax - withheld). If the amount due is negative the tax payer receives a refund. Output tax due or tax refund as positive values You will be running the program with inputs based on your student number. You will divide your student number by 100 to get the amount for wages for run 1. For run 2, you would add $10,000Eg – my student number is 5921362, then my wages are $59,213 for run 1, and $69,213 for run 2.Run your program twice using the numbers in the table above, but replace the Wages with the wage based on your student number (student number / 100, student number / 100 + 10000).

Write a program in Thonny that will calculate income tax owed given wages, taxable interest, unemployment compensation, status (single or married) and taxes withheld. Taxpayers are only allowed to use this short form if adjusted gross income (AGI) is less than $120,000. Dollar amounts are displayed as integers with comma separators. For example, print(f”Deduction: ${deduction:,}”).Hint – it will be one program but build this program in steps.Step 1 – Get Input – You will input wages, taxable int

Read More

Posted on

Write a Python function that takes as input three integers MN and r and returns an MN matrix of

Write a Python function that takes as input three integers, M, N, and r, and returns an MN matrix of rank r. Create matrices of different sizes and ranks, and use numpy.linalg.matrix_rank() to verify the returned matrices have the desired rank. Why should you expect a randomly generated matrix to have the rank you prescribe? What happens if you set r > min(M, N), and why does that happen? def randrank(M, N, r): A = random.randn(M, r) B = random.randn(N, r) return A.dot(B.T) R = randrank(32, 41, 7) print(R.shape, 'n') print(LA.matrix_rank(R), 'n') (32, 41) 7 (a) Use the function in Exercise #1 to generate a 5020 random matrix of rank r = 20, and visualize it. (b) Find the SVD of the matrix in part (a) using numpy.linalg.svd(). (c) Reconstruct the MN 2D array s with the entries of along its diagonal and zeros everywhere else: S = [s100000, s200000, sN00] if M > N, or S = [s1000, s2000, sM000000] if M < N (d) Verify that U.dot(S.dot(Vt)) recovers the matrix created in part (a). (e) Repeat (a) - (d) for a randomly generated 2050 matrix of rank r = 20.

Write a Python function that takes as input three integers, M, N, and r, and returns an MN matrix of rank r. Create matrices of different sizes and ranks, and use numpy.linalg.matrix_rank() to verify the returned matrices have the desired rank. Why should you expect a randomly generated matrix to have the rank you prescribe? What happens if you set r > min(M, N), and why does that happen? def randrank(M, N, r): A = random.randn(M, r) B = random.randn(N, r) return A.dot(B.T) R = rand

Read More

Posted on

Write a program that determines the total amount for a set of tickets based off the following

Write a program that determines the total amount for a set of tickets based on the following prices. Create a function that accepts the class type (as its letter) and the number of tickets of that class. The function should return the total price for that number of tickets. The main function should ask the user for the number of tickets of each type that was purchased and then call the function for each ticket type to calculate the subtotal of each type. The total price should be outputted in the main function.

Write a program that determines the total amount for a set of tickets based on the following prices. Create a function that accepts the class type (as its letter) and the number of tickets of that class. The function should return the total price for that number of tickets. The main function should ask the user for the number of tickets of each type that was purchased and then call the function for each ticket type to calculate the subtotal of each type. The total price should be outputted in th

Read More

Posted on

You are working on problem set Unit 4 Task Coding Part 1 OPause medianof3 0 LanguageType

You are working on problem set: Unit 4 - Task| Coding Part 1 (Pause) median_of_3 Language/Type: Python Errors: if/else return string The following function attempts to return the median (middle) of three integer values, but it contains logic errors. In what cases does the function return an incorrect result? How can the code be fixed? Determine what is wrong with the code, and submit a corrected version that works properly. def median_of_3(n1, n2, n3): if n1 < n2: if n2 < n3: return n2 else: return n3 else: if n1 < n3: return n1 else: return n3

You are working on problem set: Unit 4 – Task| Coding Part 1 (Pause) median_of_3 Language/Type: Python Errors: if/else return string The following function attempts to return the median (middle) of three integer values, but it contains logic errors. In what cases does the function return an incorrect result? How can the code be fixed? Determine what is wrong with the code, and submit a corrected version that works properly. def median_of_3(n1, n2, n3): if n1 < n2: if n2 < n

Read More

Posted on

Please design and code a Python program that will solve a problem Any problem is ok Please

Please design and code a Python program that will solve a problem (Any problem is ok). Please include arrays, Stacks and Queues, Linked Lists, Binary Trees, AVL and Red-Black Trees, and Hash Tables in the program.Please prepare a PowerPoint file that describes at a very high level (no technical) the project. The audience of this file will be non-technical people but interested to hear what kind of problems your project will solve.

Read More