Programming

Programming questions? Ask a programmer for answers ASAP

Ask a Computer Expert,
Get an Answer ASAP!

Create a class that can be used to test data structure -

Customer Question
similar to the StudentA.java example...
Create a class that can be used to test data structure - similar to the StudentA.java example foundshown below:StudentA.javaimport java.util.Scanner;import java.util.ArrayList;class StudentA implements Comparable {static java.util.Random rn = new java.util.Random ();static ArrayList firstNames = new ArrayList <>();static ArrayList lastNames = new ArrayList <>();static SORTBY sortBy = SORTBY.LAST;static int nextUID = 1;String first, last;double gpa = 0;int credits = 0;int uid = 0;static {try {java.util.Scanner scFirst = new java.util.Scanner (newjava.io.File("firstNames.txt"));java.util.Scanner scLast = new java.util.Scanner (newjava.io.File("lastNames.txt"));while (scFirst.hasNext()) firstNames.add (scFirst.next());while ( scLast.hasNext()) lastNames.add ( scLast.next());}catch (java.io.FileNotFoundException e) {System.out.println (e);} // end try catch} // end static intializerenum SORTBY {LAST, FIRST, CREDITS, GPA}public StudentA (String st) {this (new Scanner (st)) }public StudentA (Scanner sc) {uid = nextUID++;first = sc.next();last = sc.next();credits = sc.nextInt();gpa = sc.nextDouble();} // end Scanner constructorpublic StudentA () {uid = nextUID++;} // no parameter constructorpublic int compareTo (StudentA x) {switch (sortBy) {case LAST : return last.compareTo (x.last);case FIRST : return first.compareTo (x.first);case CREDITS: return credits - x.credits;case GPA : return (gpa > x.gpa)? 1 : -1;} // end switchreturn 0;} // end compareTo for Comparable interfacepublic String toString () {return String.format ("%5d %15s, %15s: %5d %10.2f", uid, last, first,credits, gpa);} // end method toStringpublic static StudentA [] makeRandom (int m) {StudentA [] sa = new StudentA [m];for (int i = 0; i < sa.length; i++) {sa[i] = new StudentA ();sa[i].first = firstNames.get (rn.nextInt (firstNames.size()));sa[i].last = lastNames.get (rn.nextInt ( lastNames.size()));sa[i].credits = rn.nextInt (120);sa[i].gpa = rn.nextDouble () * 4.0;} // end for each student to instantiatereturn sa;} // end method makeRanompublic static void main (String args []) {System.out.println (new StudentA ("***** ***** 35 3.98"));StudentA [] x = makeRandom (10);for (StudentA m: x)System.out.println (m);java.util.Arrays.sort (x);System.out.println ("---- SORTED Last -----");for (StudentA m: x)System.out.println (m);System.out.println ("---- SORTED First -----");StudentA.sortBy = SORTBY.FIRST;java.util.Arrays.sort (x);for (StudentA m: x)System.out.println (m);System.out.println ("---- SORTED Credits -----");StudentA.sortBy = SORTBY.CREDITS;java.util.Arrays.sort (x);for (StudentA m: x)System.out.println (m);System.out.println ("---- SORTED GPA -----");StudentA.sortBy = SORTBY.GPA;java.util.Arrays.sort (x);for (StudentA m: x)System.out.println (m);} // end main} // end class StudentANote that this class will be used in the projects in the rest of this course to test various datastructures and algorithmsThe following are requirements for this homework: Unique index integer fields Use at least 5 other fields of various, including at least one of each of String, int anddouble types. Write a method that will create an array of N random instances of this class, where N isan integer parameter to this method Provide a toString method that will format an instance of this class nicely Provide appropriate constructors Write methods that will write and read text files of this classo assume that the String's have no spaces within them Provide a good GUI interface to control and test this class, at a minimum:o to make this easy, assume that the first line of the file is the number of elements inthe fileo make the file one line per entryo use spaces as field delimiters in the fileso use the toString method of the class to write to the fileo use buttons to control the functions availableo use JFileChoose for selecting input and output fileso use a JTextArea and JScrollPane to create a scrolling text area for outputo the window should resize nicely - use BorderLayout with the text area in thecenterSubmit your java file(s) along with your test plan and demonstration of successfulcompilation and running for all test cases to the homework 1 submission area.
Submitted: 2 years ago.Category: Programming
Show More
Show Less
Ask Your Own Programming Question
Answered in 1 minute by:
1/17/2016
Programmer: ATLPROG, Computer Software Engineer replied 2 years ago
ATLPROG
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7,677
Experience: MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
Verified

Hello by when you need this done

Ask Your Own Programming Question
Customer reply replied 2 years ago
Hi, I need this done by midnight tonight.
Programmer: ATLPROG, Computer Software Engineer replied 2 years ago

Ok can do it by then

Ask Your Own Programming Question
Programmer: ATLPROG, Computer Software Engineer replied 2 years ago

sorry but i am out of ideas on this one. i will opt out for others. Best wishes

Ask Your Own Programming Question
Customer reply replied 2 years ago
You are JUST NOW figuring that out!!! Are you f**king kidding me????
Programmer: LogicPro, Computer Software Engineer replied 2 years ago
LogicPro
LogicPro, Computer Software Engineer
Category: Programming
Satisfied Customers: 13,458
Experience: Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
Verified

Hi,

Welcome

Hope you are doing well.

You should be using "For LogicPro only" at the start of your questions to ensure question comes to me or I may not be able to help

Do you still need it?

What is the deadline in hours?

Ask Your Own Programming Question
Programmer: LogicPro, Computer Software Engineer replied 2 years ago

Seems you did not get my previous reply.

Ask Your Own Programming Question
Programmer: LogicPro, Computer Software Engineer replied 2 years ago

Welcome

Hope you are doing well.

You should be using "For LogicPro only" at the start of your questions to ensure question comes to me or I may not be able to help

Do you still need it?

What is the deadline in hours?

Ask Your Own Programming Question
Was this answer helpful?
Ask ATLPROG Your Own Question
ATLPROG
ATLPROG
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7,677
7,677 Satisfied Customers
Experience: MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

ATLPROG is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed.

One Happy CustomerNew York

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

< Previous | Next >

Meet the Experts:

ATLPROG

ATLPROG

Computer Software Engineer

7,677 satisfied customers

MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

LogicPro

LogicPro

Computer Software Engineer

13,458 satisfied customers

Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

unvadim

unvadim

Computer Software Engineer

1,168 satisfied customers

Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

lifesaver

lifesaver

Computer Software Engineer

950 satisfied customers

Several years of intensive programming and application development experience in various platforms.

ehabtutor

ehabtutor

Computer Software Engineer

936 satisfied customers

Bachelor of computer science, 5+ years experience in software development, software company owner

TheDoctor

TheDoctor

Software Engineer

893 satisfied customers

M.S. in Internet Information Systems

The-PC-Guy

The-PC-Guy

Software Engineer

800 satisfied customers

Extensive Knowledge in PHP, MYSQL, CSS & Javascript

< Previous | Next >

Related Programming Questions
In C program. Write functions that: (a) Print all even
In C program. Write functions that: (a) Print all even numbers between 0 and 40. (b) Print all numbers between 1 and 100, with 10 numbers on each line. Use two for loops. All columns should be aligned… read more
LogicPro
LogicPro
Computer Software Engineer
13,458 satisfied customers
I am trying to write a code that generates the the koch
i am trying to write a code that generates the the koch snowflake with n iterations … read more
Chris Baxter
Chris Baxter
28 satisfied customers
I have a server and client assignment based off the last
Hey i have a server and client assignment based off the last assignment i am stucked with processing datacommented lines in gameplayframe is data needed to sent to server when client calls the frameco… read more
LogicPro
LogicPro
Computer Software Engineer
13,458 satisfied customers
Checkbook I want a formula to subtract column A from column
Checkbook I want a formula to subtract column A from column G and add add column F to column g … read more
Jason Jones
Jason Jones
AAS Information Technology
6,322 satisfied customers
I'm looking for some MVC design help for a PHP bulk webpage
I'm looking for some MVC design help for a PHP bulk webpage test tool I'm building. I can tell you what I've done already, or I can tell you what the program does and we can go from there. … read more
George Sibiya
George Sibiya
PhD
284 satisfied customers
PPT for MAC file now cannot open says corrupted. I'm running
PPT for MAC file now cannot open says corrupted. I'm running Mac 10.13.4 and PPT newest update. Crashed before I did PPT updates. File is 4 gig (I imbed videos) but critical need for Monday. Any ideas… read more
David L.
David L.
Bachelor\u0027s Degree
6 satisfied customers
I have my excel spreadsheet with subscribers name and email
I have my excel spreadsheet with subscribers name and email saved on excel and the A row or column? is all clunched up and I can't read it, the other colums are intruding onto A column if you see what… read more
Jason Jones
Jason Jones
AAS Information Technology
6,322 satisfied customers
I'm using VB 6 and trying to copy an ACCESS database and
I'm using VB 6 and trying to copy an ACCESS database and rename it. I can do that now using DBEngine.compactDatabase but now I'm trying do it with a password ***** database and having no luck. … read more
George Sibiya
George Sibiya
PhD
284 satisfied customers
How do I make variables declared in a macro available to a
How do I make variables declared in a macro available to a calledPersonal.xlsb macro? … read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
How can I change the site header and tag line font size?
How can I change the site header and tag line font size? … read more
Pete
Pete
Engineer
Bachelor\u0027s Degree
1,130 satisfied customers
I have a report that gives me customer number, part number,
I have a report that gives me customer number, part number, date sold and other various sales data for a particular month. I am trying to write a formula that will give me the most recent date for a p… read more
George Sibiya
George Sibiya
PhD
284 satisfied customers
VBA Question. I define a function in VBA but an not able to.
VBA Question. I define a function in VBA but an not able to … read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
I have Data obtained from a Computer Program that I would
I have Data obtained from a Computer Program that I would like to trend - a valve could be 103 but on the trend graph it gives a Zero. Also each of the block where the number is ***** a little green c… read more
Michael Rademacher
Michael Rademacher
MBA
10 satisfied customers
Software: Run-time error ‘340': Control array element ‘618'
Software:Run-time error ‘340': Control array element ‘618' doesn't existWhat does this mean?Thank you… read more
Michael Rademacher
Michael Rademacher
MBA
10 satisfied customers
You have helped me quite a bit in the past couple of years
You have helped me quite a bit in the past couple of years so I have what I hope is a very easy question for you - you wrote a macro code for me to do a 'Top Ten' list including ties but I now have a … read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
I think this is simple...I can't get Excel to draw a pie
I think this is simple...I can't get Excel to draw a pie chart with a particular data set, even though I have had success in the past. … read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
I password protected a page in Wordpress but can't get pass
I password ***** a page in Wordpress but can't get pass the sign in to view the page. Can you help? … read more
John Holland
John Holland
Bachelor\u0027s Degree
20 satisfied customers
I HAVE a VB program code segments which when I first run it
I HAVE a VB program code segments which when I first run it give an execution error(i.e. like converting string input to number). When I reset and run a second time, the program executes. This happens… read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x