All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Hire a Tutor
AI Study Help
New
Search
Search
Sign In
Register
study help
computer science
introduction java program
Questions and Answers of
Introduction Java Program
Write a recursive method to take 5 numbers as inputs and outputs the maximum number of these numbers.
Suppose that Staff, Faculty, and Student Worker are the subclasses of the Employee class. Indicate whether the following statements are syntactically correct or incorrect. If incorrect, indicate what
The Triangle class is derived from the RegPolygon class. Using the UML diagrams shown below, complete the following:A. List any overloaded methods in the RegPolygon and Triangle classes.B. List any
Implement a class Engineer which extends from the FullTime class discussed in Sect. 9.5. Include a data member which describes the type of engineering and a method tostring.
Write a class Vehicle which keeps a vehicle identification number, license plate number, and a number of axles. Derive two classes from the Vehicle class named Car and Truck. Include a data member
Suppose that two different types of sources are used in a term paper: books and journal articles. The following UML diagram illustrates how the sources are organized.First, implement the three
In Problem 4, the Vehicle, Car, and Truck classes were implemented. Vehicles could include more such as motorcycles, buses, trains, ships, and airplanes. Using UML diagrams, organize these vehicles.
The Triangle and Octagon classes were extended from RegPolygon class. Define the Square class which is a subclass of the RegPolygon and have the calcArea method in the Square class call
Define the Heptagon class as a subclass of RegPolygon class.
Indicate whether the following statements are syntactically correct or incorrect. If incorrect, indicate what is wrong with the statement: A. Scanner inputFile=new Scanner (new file (Sample.dat));
Consider a program that reads data from an input file named in.dat, performs calculations, and outputs the results to a file named result. out.A. What would happen if the file in. dat did not exist
Write a program that asks a user to enter a file name and three numbers, and then store the three numbers in the user-specified file. After the execution of the program, open the file with a utility
Write a program that asks a user to enter the name of a file, and count and display the number of words that appear in the user-specified file. Use a utility program to create a simple text file that
Write a program that prompts a user to enter the name of a file and a word. The program should then count all occurrences of the word in the file and display the number of occurrences. Use a utility
Rewrite the program that sorts string values stored in the file described in Sect. 10.6.2 so that it uses the bubble sort discussed in Sect. 7.7.2.
Write a program that prompts a user to enter the name of a file and a word. The input file should be a simple text file that contains a list of words. Use a binary search to look for he word the user
Perform matrix multiplications discussed in Sect. 10.6.1 using non-square matrices.
Convert the following binary numbers to their decimal equivalent:A. 00101111B. 01010010C. 01110110D. 00111001
Given the following variables, give the result of each of the following operations (show all 8 bits):int num1 =0b00110101, num2 =0b11001010, ans;A. ans = num1 \& num2;B. ans = num1 | num2;C. ans
Given the following variables, give the result of each of the following operations (show all 8 bits): int num1 = 0b00110101, num2 = 0b11001010, ans; *A. B. *C. D. ans = num1 & num2; ans = num1 |
In addition to the variables in problem 3 above, assume the existence of the following variable and answer the following questions:Data From Exercise 3Given the following variables, give the result
Converrt the following expressions using DeMorgan's rules: A. z ~x~Y; B. z = ~ (xy);
Given a variable num1, perform each of the following operations. Show all 8 bits positions in the masks.A. Clear bits 5 and 6 .B. Set bits 0 and 1 .C. Toggle bits 2, 5, and 7.D. Shift to the left 2
What would happen to an 8-bit word if it was shifted 8 bits to the left? What would happen if shifted logically 8 bits to the right?
Modify the complete program in Section 11.8 to input >>\) instead of R. Further, modify to program to allow the user to enter the number of bits to shift to the left or right.
Read another source on arithmetic right shifts such as Guide to Assembly Language [10] and then modify the complete program in Section 11.8 to include the arithmetic right shift >>.
Assume that an int variable status indicates the current state of an automobile according to the following table. Write a complete program to input the 8-bits of status and for each bit, output the
Review the Section 12.2.3 and find the myFirstPos and myLastPos for each processor for the following the cases.A. when numThreads \(=4\) and numBlocks \(=1500\)B. when numThreads \(=6\) and numBlocks
Write both serial code and parallel code to find a maximum number stored in 2dimensional array. Plot execution times of several runs with a different number of threads and to see the speed up.
Write both serial code and parallel code to perform vector addition. Plot execution times of several runs with a different number of threads and to see the speed up.
Write both serial code and parallel code to perform matrix-matrix multiplication. Plot execution times of several runs with a different number of threads and to see the speed up.
We have the following code: Make an edit to this code. What variable can we globalize to simplify the methods? You can also change the method definitions.Note you don’t need to worry about how we
Let’s take a look at the CleanCalculator code with the global variable name . Make this variable private and create a public method that gives access to the value of name. Change
You’re working for the college admissions office and need to keep track of the students’ GPAs, their names, ranks in the class year, and how high they scored on their standardized tests. The
Create a CollegeAdmission class with a main() method. Create three student objects and print out each field. Each student has the following stats: Christine Lewis: Rank: A GPA: 3.8 Test score: 83
Instead of printing out the attributes of a student in the CollegeAdmission class, create a toString() method for the Student class. Edit your print statement in the CollegeAdmission class to just
Let’s create a program where you can own pets that have a super power. A pet can have up to three attack moves, and each move has a limited number of times you can use and how powerful each move
In the Bag class, we created a static global variable called designer and created static getters and setters for it. What if we made these methods nonstatic instead?a. Remove the static keyword from
Create a new class file with a main method. Using methods provided by the String class, try to print out the following output:
Given the following code, implement the method isPalindrome(): public class Palindrome { public static void main(String[] System.out.println("true == System.out.println("false == ==
Implement the method reverseString(): public class ReverseString { public static void main(String[] args) { System.out.println("nep ==" System.out.println("licnep System.out.println("enohp
Implement the method isEqual() to check if two Strings match. Do not use == operator to compare the two Strings directly. String inputs are case sensitive. public class String Equal { public static
You have the following variable defined: Based on attack, we want to figure out what type the attack is weak against and strong against. Create a series of if/else-if/else statements to print the
Create a new class file and save it as .java called PrintTest. Inside the PrintTest class, create the main() container. Print out the following text to the command window using print statements:
Create another class file called PrintTest2 and save it as a .java file. Create a main() container inside PrintTest2. Inside the main() container, write code that will print out the following on the
Create a new class file called PrintTest3 and save it as a .java file. Create a main() container inside PrintTest3. Inside the main() container, write print statements that will print the following
Create a new class file called ComparisonTest and save it as a .java file. Create a main() container. Print out 10 > 10. What will this print out?
Within the same class file from Problem 1, print out 10 == 10. What will this print out?
Within the same class file, let’s do the following: Add 10 and 2 together, do a modulus by 5 and subtract that 6. Multiply this number by 10 and divide by 12. Print out each calculation step. What
Take a look at Code 4.8, the full Calculator code. What if we wanted to change the initial addition from 2 + 4 to 2 + 8? Make subsequent changes to the Calculator code so that the rest of the
Create a new class file called VariableTest and save it as a .java file. Create a main() container inside the Variable Test class container. Let’s declare and initialize a variable called star and
We have the following program called FillInTheBlank We have a big print statement that will print out a message based on the variables’ values. But this program will fail to run because we
Create a new class file called FloatCalculator and save it as a .java file. FloatCalculator will be the same program as VariableCalculator, except we’ll use floats instead. Make changes to the
Create a new class file called DoubleCalculator and save it as a .java file. Make all the calculations a double instead of integers based on the VariableCalculator code.
Let’s say you have a line y = 0.5x + 2.0, where 0.5 is the slope, and 2.0 is the y-intercept. Using this linear equation, we can find the (x,y) coordinates on this line. Create a new class file
Fix the following programs: What’s wrong with this program? Make the appropriate fix. public class Exercise6Problem { 1 public static void main(String[] args) { bool bool } True;
Fix the following: public class Exercise7Problem { } public static void main(String[] args) boolean bool = True; System.out.println(bool); } 3
Fix this too: public class Exercise8 Problem { } public static void main(String[] args) { boolean boolean = False; System.out.println(boolean); }
Create a new class file called OrExercise with a main() container. Use the ( ) operator to create the following outputs: IX P is true and Q is true. Therefore, P | P is false and Q is true.
Create a new class file called NotExercise with a main() container. Use ! operator to create the following outputs: X P is true. Therefore !P is false P is false. Therefore !P is true
Create a new class file called AndExericse with a main() container. Use && operator to create the following outputs: X P = true, Q = true. Therefore P && Q is true P = false, Q = true.
Let’s create a new program where we determine if a person needs to file taxes or not based on age and the income they make. Create a new class file called TaxIndicator and create a main()
Create a new class called LoopExercise and create a main( ) container. We want to output the following on the command window:a. Use a for-loop to output the above text. b. Use a while loop to output
Take a look at the following for-loop: Without running this code on the command window, write out what the print statement would be at each iteration. int index = 6; for (int i = index + 1; i <
Write Problem 2’s code using a while loop instead.Data in Problem 2 int index = 6; for (int i = index + 1; i < index + 5; i++) { i+1):" + "(" + 1 + System.out.println("(i, } " + (1 + 1) + ")");
Create a new class file with a main() method. Write a for-loop that adds numbers from x to y. For example, adding numbers from x = 1 to y = 5 should yield 1 + 2 + 3 + 4 + 5 = 15. Assume x is always
Create another method in the CleanCalculator class that computes linear functions, y = mx+b. The method’s output should be the calculated y value based on the linear formula. The method should take
Let’s say you work in Illinois, and you want to figure out how much income tax you need to pay for the year. Here is what you know: ● Your hourly wage is $10. ● You have worked 1000 hours for
Derive a flow table that describes the behavior of the circuit in Figure P9.1. Compare your solution with the tables in Figure 9.21. Is there any similarity? 3₁ У2 5
Consider the circuit in Figure P9.2. Draw the waveforms for the signals C, z1, and z2. Assume that C is a square-wave clock signal and that each gate has a propagation delayΔ. Express the behavior
Derive the minimal flow table that specifies the same functional behavior as the flow table in Figure P9.3. Present state A B C D E F G H I J K L M Σ Ζ N O P R S T U V Next state 01 B B W₂W₁ =
Find a suitable state assignment using as few states as possible and derive the next-state and output expressions for the flow table in Figure 9.42. Present state A B с D Next state W2W1 00 01 A 10
Derive the minimal Moore-type flow table that specifies the same functional behavior as the flow table in Figure P9.4. Present state A B C D E F G H J K L M Next state W2W1 = 00 01 10 A) B
Find a suitable state assignment for the flow table in Figure 9.42, using pairs of equivalent states, as explained in Example 9.15. Derive the next-state and output expressions.
Find a suitable state assignment for the FSM defined by the flow table in Figure P9.5. Derive the next-state and output expressions for the FSM using this state assignment.
Find a state assignment for the flow table in Figure 9.42, using one-hot encoding. Derive the next-state and output expressions. Present state A B C D Next state 01 B D (A) W2W1 = 00 (Α) 10 11
Implement the FSM specified in Figure 9.39, using the merger diagram in Figure 9.40a. X1 X2 D D D a X4 (a) Circuit b d b- f
Find a hazard-free minimum-cost implementation of the function f(x₁x₁) = m(0, 4, 11, 13, 15) + D(2, 3, 5, 10)
Repeat Problem 9.10 for the functionData Form Problem 9.10Find a hazard-free minimum-cost implementation of the function f (x₁,...,x5) = m(0, 4, 5, 24, 25, 29) + D(8, 13, 16, 21)
Consider the circuit in Figure P9.6. Does this circuit exhibit any hazards? D D B E A D f g
Find a hazard-free minimum-cost POS implementation of the functionf (x1, . . . , x4) = ΠM(0, 2, 3, 7, 10) + D(5, 13, 15)
Repeat Problem 9.12 for the functionf (x1, . . . , x5) = ΠM(2, 6, 7, 25, 28, 29) + D(0, 8, 9, 10, 11, 21, 24, 26, 27, 30)Data From Problem 9.12Find a hazard-free minimum-cost POS implementation of
Design an original circuit that exhibits a dynamic hazard.
A control mechanism for a vending machine accepts nickels and dimes. It dispenses merchandise hen 20 cents is deposited; it does not give change if 25 cents is deposited. Design the FSM that
Design an asynchronous circuit that meets the following specifications. The circuit has two inputs: a clock input c and a control input w. The output, z, replicates the clock pulses when w = 1;
Repeat Problem 9.17 but with the following change in the specification. While w = 1, the output z should have only one pulse; if several pulses occur on c, only the first one should be reproduced on
In the discussion of Example 9.6, we mentioned a possible use of the mutual exclusion element (ME) to prevent both request inputs to the FSM being equal to 1 at the same time. Design an arbiter
Prove that in a circuit in which all gates have a fan-out of 1, any set of tests that detects all single faults on the input wires detects all single faults in the entire circuit.
Derive a test set that can detect all single faults in the decoder circuit in Figure 4.14c. Wo- WI- En (c) Logic circuit D Yo YI Y2 Y3
List all single faults in the circuit in Figure 11.4a that can be detected using each of the tests w1w2w3w4 = 1100, 0010, and 0110. W2 W3 WA D D b D (a) Circuit D f
Sensitize each path in the combinational part of the circuit in Figure 11.12 to obtain a complete test set that comprises as few tests as possible. Show how your test set can be applied to test this
Write Verilog code that represents the circuit in Figure 11.12. W V₂ Y₁ Resetn Q D 10 o Scan-out 10 D V Clock Y₁ Y₂ Scan-in Normal/Scan
The circuit in Figure 11.12 provides an easily testable implementation of the FSM in Figure 6.76. In Example 11.3 we showed how this circuit may be tested by testing the combinational part using
Derive an ASM chart that describes the control needed to test a digital system that uses the BILBO structure in Figures 11.18 and 11.19.Figure 11.18:Figure 11.19:
Derive an ASM chart that represents the flow of control needed to test the circuit in Figure 11.12. W 1₂ Y₁ Resetn Q 10 O 10 Q Scan-out D D Z V Clock Y₁ Y₂ Scan-in Normal/Scan
Example 9.6 describes a simple arbiter for two devices contending for a shared resource. Design a similar arbiter for three devices that use a shared resource. In case of simultaneous requests,
In Example 9.21 we designed a circuit that replicates every second pulse on input w as a pulse on output z. Design a similar circuit that replicates every third pulse.Example 9.21Problem: A circuit
In Example 9.22 we merged states D and H to implement the FSM in Figure 9.82. An alternative was to merge states B and H, according to the merger diagram in Figure 9.83. Derive an implementation
Derive a table similar to Figure 11.1b for the circuit in Figure P11.1 to show the coverage of the various stuck-at-0 and stuck-at-1 faults by the eight possible tests. Find a minimal test set for
Devise a test to distinguish between two circuits that implement the following expressions f = x₁x₂x3 + X₂ X3 X4+ X₁ X₂X₁ + X1 X3 X4 g= (x₁+x₂)(x3 + x4)
Showing 100 - 200
of 741
1
2
3
4
5
6
7
8