The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Please help me for the following questions:
A word file containing description of the program, code in java, screen shots of test runs, a discussion of any difficulties encountered or new ideas.
#1
Answer the following questions about the Balanced class:
a. Is there any functional difference between the class being instantiated in the following two ways?
Balanced bal = new Balanced ("abc", "xyz") ; Balanced bal = new Balanced ("cab", "zxy") ;
b. Is there any functional difference between the class being instantiated in the following two ways?
Balanced bal = new Balanced ("abc", "xyz") ; Balanced bal = new Balanced ("abc", "zxy") ;
c. Is there any functional difference between the class being instantiated in the following two ways?
Balanced bal = new Balanced ("abc", "xyz") ; Balanced bal = new Balanced ("xyz", "abc") ;
d. Which type is pushed onto the stack? A char? An int? An Integer? Explain.
e. Under which circumstances is the first operation performed on the stack (not counting the new operation) the top operation?
f. What happens if the string s, which is passed to the test method, is an empty string?
#2:
Use the LinkedStack class to support an application that tracks the status of an online auction. Bidding begins at 1 (dollars, pounds, euros, or whatever) and proceeds in increments of at least 1. If a bid arrives that is less than the current bid, it is discarded. If a bid arrives that is more than the current bid, but less than the maximum bid by the current high bidder, then the current bid for the current high bidder is increased to match it and the new bid is discarded. If a bid arrives that is more than the maximum bid for the current high bidder, then the new bidder becomes the current high bidder, at a bid of one more than the previous high bidderA????1s maximum. When the auction is over (the end of the input is reached), a history of the actual bids (the ones not discarded), from high bid to low bid, should be displayed. For example:
New Bid              Result  High Bidder High Bid Maximum Bid
7 John  New high bidder             John     1             7
5 Hank High bid increased          John     5             7
10 Jill     New high bidder             Jill          8             10
8 Thad  No change         Jill          8             10
15 Joey New high bidder             Joey      11          15
The bid history for this auction would be
Joey      11
Jill          8
John     5
John     1
Input/output details can be determined by you or your instructor. In any case, as input proceeds the current status of the auction should be displayed. The final output should include the bid history as described above.
Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- Th-----------ank----------- Yo-----------u f-----------or -----------usi-----------ng -----------our----------- we-----------bsi-----------te -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill-----------