Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

This assignment will just focus on NookyKindle eBook orders.  That is, we'll be keeping track of the titles of eBooks and the number of orders for that particular eBook during a particular time frame (like, since the beginning of the year).

 So, the level one assignment involves using two arrays: (1) an array of Strings to store the titles of the eBooks and (2) an array of ints to store the number of orders for the corresponding eBook during the relevant period of time.  This program is about keeping track of the various eBooks that the NookyKindle eBook Corporation has been selling and keeping track of how well they are doing in terms of sales.

The two arrays mentioned above will be kept "in correspondence".  Thus, suppose the first array is called eBookList and the second array is called numOrderedList.  Then, it will always be the case that numOrderedList[k] will be the total number of orders for the eBook whose title is eBookList[k].  You may assume that a given eBook title only appears once in the array eBookList.  

Your program will involve implementing the following phases (using methods):

1) Data entry phase.  Ask the user for the number of eBook titles to be processed.  Say this value is numEBooks.  Then, you will ask the user for and get numEBooks-many pairs of values.  Each pair will contain the title of the eBook (like "WAR AND PEACE") and the total number of orders for that eBook (like 2).  Note that the book titles should be stored in upper case.  (So, "WAR AND PEACE" and not "War and Peace").  These pairs of values will be stored in the arrays eBookList and numOrderedList.

2) Data sorting phase.  This phase will involve using the bubblesort algorithm to sort the eBook data alphabetically using the (upper-cased!) names in the eBookList array.  As you rearrange the data in the eBookList array (using bubblesort), you will keep the amounts in the numOrderedList array in the correct correspondence, so that numOrderedList[k] will be maintained as the total number of orders for the eBook listed at eBookList[k].   As you swap the eBook titles during bubblesort, the corresponding number of orders will have to be swapped.

3) Data searching phase.  During this phase the user will be given the following prompt for input in a loop:

Enter eBook title or * to quit:

If the user enters '*', then the searching process will come to an end and the program will terminate.  If the user enters anything else, that input data will be treated as the title of an eBook.  The binary search algorithm will then be used to find that eBook in the sorted array, eBookList.  If that eBook is found, then the total number of orders for that eBook will be displayed.  If that eBook is not found, the program will display a message such as:

No data for that eBook was found.

The searching continues until the user enters '*' in response to the "Enter eBook title or * to quit:" prompt.  Note that the searches should not be case-sensitive.  All eBook titles should be stored in the array eBookList in upper case.  Likewise, search keys entered during the searching phase (i.e., the titles of eBooks the user is searching for) should also be upper-cased.

 (Level Two)

For the level two assignment in lieu of using two arrays to store the eBook order data use one array, an array of EBookOrderData objects.  Here is the UML diagram for a simple EBookOrderData class appropriate for this assignment:

EBookOrderData

- title : String

- orders : int

+ EBookOrderData()

+ EBookOrderData(aTitle: String,

    numOrd: int)

+ setTitle(aTitle: String) : void

+ setOrders(numOrd: int) : void

+ getTitle() : String

+ getOrders() : int

The program behavior (from the user's perspective) will be exactly the same as in the level one (non-extra-credit) assignment.  However, as the eBook order data is entered, it will be stored in an array of EBookOrderData objects.  After the data entry phase is completed, the array of EBookOrderData objects will be sorted using the bubblesort algorithm.  The EBookOrderData array will be sorted based on the titles of the eBooks (i.e., using the title field in the EBookOrderData objects in the array).

Then, the program will enter the searching phase.  When the user enters the name of an eBook to be searched for, the binary search algorithm will be used to attempt to find that eBook in the array of EBookOrderData objects.  Again, the program's behavior (from the user's perspective) will be identical to the behavior in the level one assignment.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9523308

Have any Question?


Related Questions in Programming Language

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As