Now trace this series of who built on whos work. Who invented the laser printer? One of the winners of the ACM Turing Award (the closest that computer science has to a Nobel Prize) invented a...
You are running a bingo game where you want to tweet the winner of each round of the game.You want to announce the name of who won, and how much they won in dollars. Make a function that takes those...
Create a function like the pyramid function that does the upside-down version. Your function invertedPyramid should also take an input character and print an inverted pyramid.
You have written an essay for school, and it has to be at least five pages long. But your essay is only 4.5 pages long!You decide to use your new Python skills to make your essay longer by spacing...
Write a function to blend two pictures, starting with the top third of the first picture and then blend the two together in the middle third and then show the last third of the second picture. This...
One of the four functions below generated this picture. Which one is it? A. B. C. D. def flip1(picture): allpixels = getPixels(picture) In = len(allpixels)-1 address = In for index in range (0,1n/2):...
One of the below programs that when called like this (with the underscore representing a digit from 1 to 4) generates this output: >>> mixem_("we hold these truths") 'w.e. .h.o.l.d. .t.h.ese truths'...
Write a function to draw a simple face with eyes and a mouth. on a picture.
Write a general crop function that takes a source picture, the start X value, the start Y value, the end X value, and the end Y value. Create and return the new picture and copy just the specified...
Create a CartoonPanel class that takes an array of Pictures and displays the pictures from left to right. It should also have a title and author, and display the title at the top left edge and the...
Write a program that produces the following figure (which vaguely resembles the Seattle Space Needle) as its output using nested for loops. Use a class constant to make it possible to change the size...
Write a Java program called Lanterns that generates the following output. Use static methods to show structure and eliminate redundancy in your solution. ** ***** **** ***** ********* ***** **...
Your country is at war and your enemies are using a secret code to communicate with one another. You have managed to intercept a message that reads as follows: :mmZ\dxZmx]Zpgy The message is...
You have an augmented reality game in which you catch Edoc and acquire Edoc candy. You need 12 candies to evolve an Edoc into a Margorp. An evolution earns you back one candy. Each evolution also...
Write a recursive method that will count the number of vowels in a string. Each time you make a recursive call, use the String method substring to construct a new string consisting of the second...
Write a JavaFx application that displays a series of pictures of a person with arms, legs, and of course a head. Use a happy face for the head. Use ovals for the body, arms, and legs. Draw a sequence...
Write a grading program for an instructor whose course has the following policies: Two quizzes, each graded on the basis of 10 points, are given. One midterm exam and one final exam, each graded on...
Create a class that represents a grade distribution for a given course. Write methods to perform the following tasks: Set the number of each of the letter grades A, B, C, D, and F. Read the number of...
Write a program to answer questions like the following: Suppose the species Klingon ox has a population of 100 and a growth rate of 15 percent, and it lives in an area of 1500 square miles. How long...
Write a new class TruncatedDollarFormat that is the same as the class DollarFormat from Listing 6.14, except that it truncates rather than rounds to obtain two digits after the decimal point. When...
Write a program that plays a simplified dice version of blackjack. Instead of selecting from a deck of cards a 14-sided die is rolled to represent a card. The rules of the game for one round, as...
Write a program that shows the total number of presents that the person in the song The Twelve Days of Christmas received on each day, as indicated in Table 3.5. Table 3.5 Twelve Days of Christmas
Add a method bubbleSort to the class ArraySorter, as given in Listing 7.10, that performs a bubble sort of an array. The bubble sort algorithm examines all adjacent pairs of elements in the array...
Add a method insertionSort to the class ArraySorter, as given in Listing 7.10, that performs an insertion sort of an array. To simplify this project, our insertion sort algorithm will use an...
The class TimeBook in Listing 7.14 is not really finished. Complete the definition of this class in the way described in the text. In particular, be sure to add a default constructor, as well as set...
Sudoku is a popular logic puzzle that uses a 9 by 9 array of squares that are organized into 3 by 3 subarrays. The puzzle solver must fill in the squares with the digits 1 to 9 such that no digit is...
Write a piece of code that prints an array of integers in reverse order, in the same format as the print method from Section 7.2. Consider putting your code into a method called printBackwards that...
Students are often asked to write term papers containing a certain number of words. Counting words in a long paper is a tedious task, but the computer can help. Write a program that counts the number...
Write a constructor for the UndergraduateStudent class that accepts a name as a parameter and initializes the UnderGraduateStudent s state with that name, an age value of 18, and a year value of 0.
Write a program that produces the following figure (which vaguely resembles a textbook) as its output using nested for loops. Use a class constant to make it possible to change the size of the figure...
Write a program that produces as output the words of The Twelve Days of Christmas. (Static methods simplify this task.) Here are the first two verses and the last verse of the song: On the first day...
Write a complete Java program called WellFormed that prints the following output:
Why is recursion an effective way to implement a backtracking algorithm?
Rewrite the list insertion method of Example C 16.40 in F# instead of C#. Compile to CIL and compare to the right side of Figure C 16.7. Discuss any differences you find. Figure 16.7 . method private...
The grammar of Figure 15.6 assumes that all variables are global. In the presence of subroutines, we should need to generate different code (with fp-relative displacement mode addressing) to access...
What characteristic does Ruby share with Smalltalk?
One problem (of many) with the code we generated in Section 15.3 is that it computes at run time the value of expressions that could have been computed at compile time. Modify the grammar of Figure...
The class StringLinkedListWithIterator (Listing 12.9) is its own iterator, but it does not quite implement the Java Iterator interface. Redefine the class StringLinkedListWithIterator so that it...
Write some code that will use an iterator to duplicate every item in an instance of StringLinkedListWithIterator in Listing 12.9. For example, if the list contains "a", "b", and "c", after the code...
For this project, we will create a data structure known as a queue. A queue can be thought of as a line. Items are added at the end of the line and are taken from the front of the line. You will...
Write the state of the elements of each of the following arrays after each pass of the outermost loop of the selection sort algorithm has occurred (after each element is selected and moved into...
Create an application that will keep track of several groups of strings. Each string will be a member of exactly one group. We would like to be able to see whether two strings are in the same group...
Repeat the previous programming project, but read the input data from a file and send the output to another file. If you have covered binary files, use binary files; otherwise, use text files. Read...
An element can be inserted at the beginning, middle, or end of an array list. Which of the three insertion points is the most computationally expensive, and why? Which is the most expensive location...
Define a variation on StringLinkedListSelfContained from Listing 12.7 that stores objects of type Employee, rather than objects of type String. Write a program that uses this linked-list class to...
Define ordinal, enumeration, and subrange types.
Analyze and write a comparison of using C++ pointers and Java reference variables to refer to fixed heap- dynamic variables. Use safety and convenience as the primary considerations in the comparison.
Describe three specific programming situations that require a posttest loop.
Suppose you want to write a method that prints a heading on a new output page, along with a page number that is 1 in the first activation and that increases by 1 with each subsequent activation. Can...
Write a JavaFX application that uses a text field to get the name of a file, reads the file byte by byte, and displays the bytes as characters. (Exercise 15 describes how to convert a byte value to a...
How can the parent version of an inherited method that is overridden in a subclass be called in that subclass in C#?
Based on the log file described in Programming Project 10 write a program to detect cheating. This could occur if: A racer misses a sensor, which is a sign that the racer may have taken a shortcut. A...
Modify the class LapTimer, as described in Exercise 13 of Chapter 9, as follows: Add an attribute for a file stream to which we can write the times Add a constructor LapTimer(n, person, fileName) for...
Complete and fully test the class Person that Exercise 10 describes. Include the following additional methods: getNamereturns the name of the person as a string. getAgereturns the age of the person....
The following program contains 7 mistakes! What are they? What output is produced for each of the following calls? a. IfElseMystery1(3, 20); b. IfElseMystery1(4, 5); c. IfElseMystery1(5, 5); d....
A URL is a type of _________. a. Web page b. URI c. Link d. Network
How do you use the test() method of the RegExp object to check a string against a regular expression?
What string property returns the number of characters in a string?
How would the results of the following two statements differ?
What type of error occurs when the interpreter fails to recognize code? a. Debugging b. Syntax c. Run-time d. Logic
Modify your program from the previous exercise to draw the figure by a method called drawFigure . The method should accept three parameters: the Graphics g of the DrawingPanel on which to draw, and a...
Which API provides access to data from a devices gyroscope and accelerometer? a. Geolocation API b. Battery Status API c. Device Orientation API d. WebRTC API
What number is displayed by this program? Set Number1 = 4 Set Number1 = Number1 + 1 Set Number2 = 3 Set Number2 = Number1 * Number2 Write Number2
Write a program that reads a file containing data about the changing popularity of various baby names over time and displays the data about a particular name. Each line of the file stores a name...
Write a class called Date that represents a date consisting of a year, month, and day. A Date object should have the following methods: public Date(int year, int month, int day) Constructs a new Date...
The term defensive programming refers to which of the following (select all that apply): a. Ensuring that input data are in the proper range b. Ensuring that a division by 0 does not take place c....
If X = 1 and Y = 2 determine whether each of the following expressions is true or false. (a) T F X >= X OR Y >= X (b) T F X > X AND Y > X (c) T F X > Y OR X > 0 AND Y < 0 (d) T F NOT(NOT(X == 0) AND...
Add a transfer method to the BankAccount class from the previous exercises. Your method should move money from the current bank account to another account. The method accepts two parameters: a second...
Write a class named Dodecagon whose objects represent regular dodecagons (12-sided polygons). Your class should implement the Shape interface defined in this chapter. A Dodecagon object is defined by...
The number N factorial, denoted by N!, is defined to be the product of the first N positive integers: N! = 1 2 . . . N For example: 5! = 1 2 3 4 5 = 120 7! = 1 2 3 4 5 6 7 = 5,040 Find...
Give the output of the loop in Exercise 19. Data from Exercise 19 Declare K As Integer For (K = 3; K
The Sierpinski carpet is a fractal that is defined as follows: The construction of the Sierpinski carpet begins with a square. The square is cut into nine congruent subsquares in a 3-by-3 grid, with...
Write a method called reverse that accepts a map from strings to strings as a parameter and returns a new map that is the reverse of the original. The reverse of a map is a new map that uses the...
Write a program that solves the classic stable marriage problem. This problem deals with a group of men and a group of women. The program tries to pair them up so as to generate as many stable...
What is the output of the code corresponding to the following pseudocode? Declare I, J As Integer For (I = 1; I
What is the output of the code corresponding to the following pseudocode? Declare HelloCount As Integer Set HelloCount = 1 Repeat Repeat Write "Hello" Until HelloCount >= 1 Set HelloCount =...
To which complexity class does the following algorithm belong? public static void mystery2 (int [] list) { for (int i = 0; i < list.length / 2; i++) { int j = list.length 1 i; int temp = list[i];...
To which complexity class does the following algorithm belong? public static void mystery4 (List list) { for (int i = 0; i < list.size () 1; i += 2) { %3D String first list.get (i); !! list.set (i,...
The factorial of a positive integer N, denoted by N!, is defined by the following: N! = 1 2 . . . N (Note: 0! = 1 ) Using subprograms and functions, create a recursive program to compute N!. The...
Consider the following C program: What is the value of x after the assignment statement in main, assuming a. Operands are evaluated left to right. b. Operands are evaluated right to left. int fun...
Redo Programming Challenge 6 but use a binary search. Bonus: Add pseudocode to check how many iterations must be made for each number entered by the user, and, if you also complete Programming...
Open the Debug Solution (Debug Solution.sln) file contained in the VB2015\Chap06\ Debug Solution-B15 folder. Open the Code Editor window and review the existing code. Start and then test the...
Create a Visual Basic Windows application. Use the following names for the solution and project, respectively: Warren Solution and Warren Project. Save the application in the VB2015\Chap01 folder. a....
In this exercise, you modify one of the Projected Sales applications from this lesson. Use Windows to make a copy of the Sales Solution-For Next folder. Rename the copy Sales Solution-Do While. Open...
Create a Visual Basic Windows application. Use the following names for the solution and project, respectively: Valley Solution and Valley Project. Save the application in the VB2015\Chap01 folder....
In this exercise, you learn about the Format menus Align, Make Same Size, and Center in Form options. a. Open the VB2015\Chap01\Format Solution\Format Solution (Format Solution.sln) file. If...
In this exercise, you modify one of the Concert Tickets applications from this lesson. Use Windows to make a copy of the Concert Solution-Sub folder. Rename the copy Modified Concert Solution-Sub....
The Internet contains a vast amount of code snippets that you can use in your Visual Basic applications. And in many cases, you can use the snippet without fully understanding each line of its code....
In this exercise, you will create a splash screen that has a transparent background. a. Open the VB2015\Chap01\Transparency Solution\Transparency Solution (Transparency Solution.sln) file. If...
In this exercise, you modify the Favorites application from this lesson. Use Windows to make a copy of the Favorites Solution folder. Rename the copy Modified Favorites Solution. Open the Favorites...
In this exercise, you will continue creating the Jordan Sports Store application from Lesson As Exercise 2. Create a Visual Basic Windows application. Use the following names for the solution and...
In this exercise, you complete the Jordan Sports Store application from Exercise 2 in both Lesson A and Lesson B. Open the VB2015\Chap02\Jordan Solution\Jordan Solution (Jordan Solution.sln) file. a....
Modify the HeapIntPriorityQueue class written in this chapter to make it configurable in ways similar to Javas PriorityQueue class. Make it possible for the heap to be a min-heap or max-heap. (If you...
In this exercise, you complete the Cranston Berries application from Exercise 3 in both Lesson A and Lesson B. Open the VB2015\Chap02\Cranston Solution\Cranston Solution (Cranston Solution.sln) file....
Write a method called descending that accepts an array of integers and rearranges the integers in the array to be in descending order using a PriorityQueue as a helper. For example, if the array...
K & L Clothiers wants you to create an application that prints a customers sales receipt. A sample receipt is shown in Figure 3-49. Use the following names for the solution and project, respectively:...
Create an application that displays a circles area and circumference, given its radius. Use the following names for the solution and project, respectively: Circle Solution and Circle Project. Save...
Explain why a class might provide a set method and a get method for an instance variable.
Factorials are used frequently in probability problems. The factorial of a positive integer n (written n! and pronounced n factorial) is equal to the product of the positive integers from 1 to n....
In this exercise, you experiment with procedure-level and class-level variables. Open the VB2015\Chap03\Scope Solution\Scope Solution (Scope Solution.sln) file. The application allows the user to...