Verify if records are in alphabetical order based on names

Assignment Help JAVA Programming
Reference no: EM13941003

I need a Java solution that can verify if records are in alphabetical order based on last name then first name. I need this solution in 2 classes:

1. One with the main method that prompts the user for the input filename (merchants.txt). If the input file cannot be opened, the method should continue to reprompt the user for the correct filename, until the file can be opened. The file should be read, and the method should verify that the file is in ascending order. If it is not, an appropriate error message should be displayed, and the program should terminate. As the merchant records are read in, they should be displayed on the screen.

2. The second class should be named "Merchant" and I want it to implement the predefined interface "Comparable". Its instance variables should include first name, last name, an integer number of orders completed, and a floating-point rating average. This class should contain the following methods:

- A method "inputFile" that reads in a merchant record from a file. All the data fields should be separated by at least one space. The order of the fields is first name, last name, orders, and rating.

- A method "displayOutput" that writes out a merchant record to the screen. The name should be output last name first, separating the last and first names with a comma.

- A method "compare_To" that compares two merchant records. I just need the names compared. The last name is more significant than the first. The method should return a -1 if the 1st name is less than the 2nd, a 0 if they are equal, and a 1 if the 1st name is greater than the next name.

- A method "equals_To" that compares two merchants. I just need the names compared as with the compare_To method.

Attachment:- Merchants.txt

Reference no: EM13941003

Questions Cloud

The management of m&e ltd : The management of M&E Ltd has just been informed by their research department that recent breakthroughs have led to the development of a new product codenamed the Tenby. The management has decided to call a meeting to discuss whether to proceed wi..
Develop appropriate text for each document : Design the products, select the format and style as well as any graphics you will use. Develop appropriate text for each document. Prepare a draft of each document and have it proofed.
Estate agents act and regulations : List three key areas covered by the Estate Agents Act and Regulations. List three key areas covered by the Sale of Land Act Regulations.
Governance processes according to the uk commission : Pick an institution and audit its governance processes according to the UK Commission's Principles of Good Governance. Your governance audit should:
Verify if records are in alphabetical order based on names : I need a Java solution that can verify if records are in alphabetical order based on last name then first name. I need this solution in 2 classes
What is history and purpose of copyright infringement law : What is copyright infringement? What is the history and purpose of the copyright infringement law? How does this law affect freedom of speech and press in regards to the first amendment?
Software games company avalanche entertainment : Software games company Avalanche Entertainment is considering expanding its highly successful online game franchise to either the board game or trading card environment. The company has decided that it will invest in one project but not both. The ..
Determine the stated interest rate on the bonds : Determine the stated interest rate on these bonds. Calculate the interest expense and the discount amortization for the interest period ending June 30, 2010.
Analysis on existing personal skills and knowledge : A SWOT analysis on existing personal skills and knowledge, and skills that need to be developed in the future in order to succeed in study and work.'

Reviews

Write a Review

JAVA Programming Questions & Answers

  Develop a queue class

Print-out of the text file that contains your restaurant information and develop a Queue class. Hint: Check out the sample Queue java source files included with this assignment. Declare a class Party to hold one party.

  Java program that computes a ride you took in taxi

Write a java program that computes a ride you took in taxi. The bill computed based on an initial cost plus the taxi charges 0.5 dirham every 0.3 km.

  Price and quantity of an article

XYZ Supermarket wants a program that will prompt for the product code, pricing code, price and quantity of an article. Your program is then to calculate a discount rate according to the pricing code.

  Java program on eclipse

Using a while( true ) loop,and using the upper case alphabeth from Z to A,print the lower case alphabeth and its corresponding ascii values.You must terminate/exit/break this loop once you process the last letter (A).

  Pronouns, and prepositions

Type addKeyword(): for each word on each page, add to a (keyword, URLs) list or dictionary, excluding articles, pronouns, and prepositions. For example:

  Prepare a program that constructs a binary tree and

prepare a program that constructs a binary tree and traverses the tree in pre-order in-order and post-order methods.

  Create an application in which a user can enter a phone book

Create an application in which a user can enter a phone book entry, including the subsequent elements: First Name, Last Name, Phone Number, email address

  Constructs a rectangle object

Write an AreaTester program that constructs a Rectangle object and then computes and prints its area. Use the getWidth and getHeight methods. Also print the unexpected answer.

  Java program that prompts the user to input an integer

Write a Java program that prompts the user to input an integer and then outputs both the individual digits of the number and the sum of the digits.

  Demonstrate the use of array or arraylist

It will calculate the additional amount of sales that each salesperson must achieve to match or exceed the higher of the two earners. The application should ask for the name of each salesperson being compared.

  Hasanodddigit that returns whether any digit

d named hasAnOddDigit that returns whether any digit of a positive integer is odd. Your method should return true if the number has at least one odd digit and false if none of its digits are odd. 0, 2, 4, 6, and 8 are even digits, and 1, 3, 5, 7, 9 a..

  Create the program which converts fahrenheit to celsius

Create the following program which converts Fahrenheit to Celsius. Read integer Fahrenheit temperatures from the user.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd