Design, implement and test a Java class that processes a series of triangles. The triangle specification will be identical to that in Programming Assignment #2 (part A). As in that assignment, you will read in the three sides of the triangle, check the input for errors (and handle them if found), classify the triangle and compute its area. For this assignment, triangle data will be read from an input file and the program’s output will be written to another file. The output file will also include a summary of the data processed. You must use at least one dialog box in this program.


The data for each triangle will be on a separate line of the input file, with the input data echoed and the results referred to by the line number (see example).

Some things to note:

• All input data lines must be processed.

• A new line with triangle data always starts with the ‘#’ marker.

• If an error is encountered on a given line, it must be handled. Afterwards, the program will continue on the next line without processing the triangle. An example of such an error is a non-integer appearing in the first three values of a given line.

• Extraneous data must be discarded. This is data that appears after the first three triangle sides are found, but before a new triangle marker is found.

• If the end of file (EOF) is found, a message should be printed out

• There shall be no unhandled file related exceptions and an end-of-file exception must be avoided.


On initialization, the program will prompt the user for both an input and an output file. If a non-existent input file is specified, the appropriate exception must be handled, resulting in an error message. For the exception case, re-prompt the user for the correct input file [Extra credit if you implement a JFileChooser type dialog box]. Once the I/O file is specified, the program will read in and process all the entries in the file. The output of the program will be written to the specified output file and echoed to the console.


The program will evaluate each line and determine the validity of the triangle. If valid, the program will output summary line for the triangle calculation (see Programming Assignment #2A). If invalid, the program will output a description of the error found in the entry. Your program must be robust and handle situations where all the triangle inputs are not proper and/or present.


Once all the entries are processed, a summary will be generated providing the following information:

• Pathname of the input file

• Number of lines processed

• Number of valid triangles

• Number of invalid triangles



You should be able to reuse much of your Programming Assignment #2A code for this project. However, strongly recommend that you rewrite your code and put this functionality in separate method(s). Likewise, any residual problems from #2A should be fixed in this version. The main features you will be adding are:


• Multiple methods

• Exception handing

• File I/O

• Dialog box

Answers

Answer 1

public class GeometricObject {

   private String color = " white ";

   private boolean filled;

   private java.util.Date dateCreated;

   public GeometricObject() {

       dateCreated = new java.util.Date();

   }

   public GeometricObject(String color, boolean filled) {

       dateCreated = new java.util.Date();

       this.color = color;

       this.filled = filled;  

   }

   public String getColor() {

       return color;

   }

   public void setColor(String color) {

       this.color = color;

   }

   public boolean isFilled() {

       return filled;

   }

   public void setFilled(boolean filled) {

       this.filled = filled;

   }

   public java.util.Date getDateCreated() {

       return dateCreated;

   }

   public String toString() {

       return "Created on " + dateCreated + "\n color: " + color + " and filled ";                

   }  

}


Related Questions

A text-editing application uses binary sequences to represent each of 210 different characters. What is the minimum number of bits needed to assign a unique bit sequence to each of the possible characters

Answers

Answer:

8

Explanation:

The minimum number of bits that one needs to give a unique bit sequence to each of the possible characters is 8.

The minimum number of bits that one needs to give a unique bit sequence to each of the possible characters is 8.

What are binary sequences?

A binary sequence is known to be also called a bitstream. This is regarded as is a string of ones and zeros. The information in storage which can be in form of text message, a photograph, a song, a computer program, etc. may looks the same, like in a form or sequence of bits.

Historically, the most commonly used text code is the IRA or the International Reference Alphabet, in which each character in this code is represented by a unique 7-bit pattern. Since each character in this code is represented by a 7-bit binary code, there are 128 different characters that can be represented here.

The characters that are encoded with International Reference Alphabet, are always stored and transmitted using 8-bits per character, where the 8th bit is a parity bit mainly used for error detection.

Therefore, The minimum number of bits that one needs to give a unique bit sequence to each of the possible characters is 8.

Learn more about binary code on:

https://brainly.com/question/29792509

#SPJ2

What can designers use multimedia authoring tools for?

Answers

Answer:

A. creating and editing video

If a storage pool is configured as if it has more virtual storage than the physical drives actually offer, what feature is being used?.

Answers

The feature being used is thin provisioning.

what is the chip that allows the screen to work

Answers

Answer:

V-chip technology works much like closed captioning and uses the vertical blanking interval in the television signal.

Answer:

V-chip technology works much like closed captioning and uses the vertical blanking interval in the television signal.

Explanation:

Which of the following best describes the average amount of stored data per user for the first eight years of the application existence

Answers

The option that best describes the average amount of stored data per user for the first eight years of the application existence is memory.

What is  RAM memory?

The memory of a system is known to bee RAM which is Random Access Memory.

Conclusively, This is known to be  a part of system hardware where operating system (OS), and data are saved. The option that best describes the average amount of stored data per user for the first eight years of the application existence is memory.

Learn more about data from

https://brainly.com/question/19243813

#SPJ1

In what higher-order function do you apply a predicate to each value within a list, and if the predicate returns true, the value is added to an object

Answers

Answer:

Returning function

Explanation:

As functions are objects, we can also return a function from another function. In the below example, the create_adder function returns adder function.

How to solve level 53 on rapid router?

Answers

<img src=/static/game/image/actions/go.svg alt=' + ugettext(play= button)= += '= style=width: 4%;> ) def noPermissionMessage():

Big Data _______________. Relies on the use of unstructured data imposes a structure on data when it is captured relies on the use of structured data captures data in whatever format it naturally exists

Answers

Answer:

captures data in whatever format it naturally exists

Explanation:

quizletBig Data _______________. Relies on the use of unstructured data imposes a structure on data when it is captured relies on the use of structured data captures data in whatever format it naturally exists

This is an example of what type of formula?

=(D1+D17)

Question 2 options:

ADDITION


SUBTRACTION


RANGE


AVERAGE

Answers

Answer:

Average

Explanation:

The term 'average' refers to the 'middle' or 'central' point. When used in mathematics, the term refers to a number that is a typical representation of a group of numbers (or data set). Averages can be calculated in different ways - this page covers the mean, median and mode.

Part B Identify the Boolean data type in the database and explain why it is a Boolean field.​

Answers

Answer:

Talent Show Registration

Explanation:

Boolean is True or False so the only one that is true or false is Talent Show Registration as there is Yes and No

When programmers work together, what is an example of how abstraction in programming can promote collaboration?.

Answers

Answer:

. When programmers work together, what is an example of an abstraction in programming that can promote collaboration?

Explanation:

answer choices Team members can rely on one another to explain their code. Programmers can write functions without needing ot know what they do or how they should work.

You want to a get a rough idea of how many art assets you'll need to create for your next project. What is the best way to do this?

A. Ask for advice on Scratch's forum section

B. Build off a similar Scratch project

C. Write out a prototype of your project on paper

D. Examine the code from a similar Scratch
project

Answers

The best way to do this is to Ask for advice on Scratch's forum section.

Why is art an asset?

Art as is known to be an asset because it is said to be attractive and its worth often grows up in the long run.

Note that The best way to do this is to Ask for advice on Scratch's forum section as one will be able to know what to do and not to do.

Learn more about art assets  from

https://brainly.com/question/8084221

#SPJ1

To work with dates, you need to import Group of answer choicesthe date class from the datetime modulethe date, time, and datetime classes from the datetime modulethe date and datetime classes from the datetime modulethe date class from the date module

Answers

Answer:

datetime.time

Explanation:

datetime.time is an idealized time that assumes there are 86,400 seconds per day with no leap seconds. This object stores the hour, minute, second, microsecond, and tzinfo (time zone)

If you have two folders open on your desktop and you want to move a file from one folder to the other, simply ________ the file

Answers

Answer:

copy

Explanation:

The critical components of the operating system that remain in memory as long as the computer is running are commonly known as the

Answers

Answer:

KERNEL

Explanation:

Q:

The critical components of the operating system that remain in memory as long as the computer is running are commonly known as the

A:

KERNEL

Compose an e-mail to your coworker Adam that describes how to add a photograph to a slide.

Answers

The ways to add a photograph to a slide is given below: What to write when composing the email is also given below.

How do you Insert photos into a slide?

The steps are given below?\

The first thing to do is to open  the slide you want to insert the image on.then click on Insert menu, and take the cursor to the Picture, and then one can click Photo Browser or insert pictures.Then select the picture that you want and and one can drag it onto the slide.

Note that it is essential to follow the steps and one can add as many pictures as they want to their slides.

Learn more about e-mail from

https://brainly.com/question/24506250

#SPJ1

Write a function called middle(string str) that returns a string containing the middle character in str if the length of str is odd, or the two middle characters if the length is even. Write the main that tests this function.

Answers

Answer:

Note: a) If the length of the string is odd there will be two middle characters.

Explanation:

b) If the length of the string is even there will be one middle character. There was a problem connecting to the server. Please check your connection and try running the trinket again.

write a letter to your future self :”Imagining a world in 2030”.Be sure to mention things that you think your future self would probably be doing and experiencing in daily life. You may include your hobbies, your surroundings, the role of AI in your life, etc.

Answers

To write a letter to your future self, follow the steps:

Start with an introduction in the first paragraph.The next is what you want your future self to know in the second paragraph.The last is conclusion in the third paragraph.What is a Letter?

A letter is known to be a form of a written message that passes information from a person to another.

Note that by following the steps above, one can be able to  write a letter to your future self.

Learn more  about letter from

https://brainly.com/question/24140747

#SPJ1

15. Question

What type of network address space allows for nodes on a network to communicate with each other,

but prevents any gateway router from forwarding traffic there, and are reserved for internal

networks?

58:1

Subnet mask

Non-routable address space

IP address

MAC address

Type here to search

O

Answers

Answer:
Non-routable address space.

Explanation:
Every computer need not to be connected to every other computer on the internet, non-routable address spaces can be used locally, in various private networks.

Which of the following describe the characteristics of a good logo? Choose all that apply. It is a complex design It is memorable. It utilizes the elements of design. O It is trendy​

Answers

Answer:

It is memorable.

It utilizes the elements of design.

Explanation:

IMO these 2 will determine a good logo. Since everyone should remember it if they come across it again in the future

briefly explain the emerging trends in micro computer technology according to size

Answers

Answer:

Emerging trends in IT include big data analytics, virtual and augmented reality, 5G, and the internet of things. Computer science workers can learn about computer science current events and new technologies by joining a professional organization.Mar 3, 2022

Security is a major concern with m-commerce. How can m-commerce software ensure the security of transmissions and that the transaction is being made with the intended party

Answers

Answer:

Security in communication between applications and sites in m-commerce can use SSL technology.

Explanation:

While developing an app, developers have to perform several checks and ensure that the server has a legitimate certificate.

Ninety percent of the fastest-growing jobs require some kind of postsecondary education.
true
false

Answers

Answer:

True

Explanation:

2. What is the difference
between a folder and sub
folder

Answers

Answer:

In a computer file system, a subdirectory is a directory that is contained another directory, called a parent directory. A parent directory may have multiple subdirectories. In operating systems with a GUI such as Microsoft Windows, a directory is called a folder, and a subdirectory is called a subfolder.

Cost and equity is one of the four intertwined issues that must be taken into consideration when institutions thinks of implementing ICTs in teaching and learning

Answers

The major issues includes in the e-learning with the use of ICTs are cost, effectiveness, equity and sustainability.

What is ICTs in teaching and learning?

ICT or Information and Communication Technology are used to communicate, create and manage the information source.

The use of ICTs in education forms the basis for e-learning. There issues faced in considering ICTs in education include cost, effectiveness, equity, and sustainability.

Thus, the given statement about the issues faced by ICTs in education is correct.

Learn more about ICTs, here:

https://brainly.com/question/20717870

#SPJ1

What is the purpose for brainstorming & screening in product/service management?
Maintain revolving inventory
Generate new product ideas
Evaluate management effectiveness
Evaluate feedback from competitors

Answers

Answer:

Generate new product ideas

Explanation:

Brainstorming allows for new ideas to come up and screening allows us to confirm that we are not recycling old ideas

You are building a game that needs to do the following:

•Make the player unable to cross walls of yellow blocks

•Make the player "faint" and start
over if it touches a red block

•Make the player win if it touches a green block

Which three modules would you need to use?

A. An "if () then" block that outputs movement to the initial position if
the sprite touches a red block.

B. An "if () then" block that outputs a small change in position if the
sprite touches a yellow block, one for each direction

C. A "forever" block that outputs different messages in sequence as
the player navigates

D. An "if () then" block that outputs a happy sound
the sprite touches a green block
and message if the spirit touches a green block

Answers

green block and the red block

A company sells computers only over the internet. Customers can decide their own computer configuration at the company's website and then place the order for the computer. This is an example of:

Answers

Answer:

This is an example of business to consumer e commerce

if you click on repeat header rows what will happen?

Answers

It’s going to put a header row on your page

Which method would you use to get the value associated with a specific key and remove that key-value pair from the dictionary

Answers

We would use the the “pop method” which accepts a key and returns the value associated with that key and removes that key-value pair from the dictionary

Hope this helps!
Other Questions
Which best explains why a 90-year-old patient would be checked into hospice?He cannot control her bladder function, eat, or bathe himself.He is recovering from a liver transplant.He has SIDS and can no longer function on his own.He has somatic death and machines are keeping him alive. Extinction, Speciation, or Gene flow happens when a lineage splits into two or more lines of descent.FOR ENGLISH CLASS Which of the following is not a function of coral reefs? Solve the system. And explain please cause I have 4 more The second photo is an example of what needs to be done, excuse the bad handwriting lol. please please urgentttt!!!!!its geometry Why is not the term perimeter used instead of circumference? is tomato candy good for people who didn't like the taste of tomato Consequences of plagiarism Suppose JMNKQR.Which congruency statements are true?Select each correct answer.MQNJKQNMRKQKMJMNQR THINK SCIENTIFICALLYThe students in Mr. Seemy's class are about to take a test on organizing and interpreting data. Mr. Seemy asks, "What wouldyou say if I told you that those of you who got an A on this test would get $20?"Td say that's the best news I've heard all year!" exclaims Shantel. "I would be much more motivated to study if I knew!could make money for doing well."Mr. Seemy says. "The school is thinking about implementing a program to pay students when they get good grades.It would be a partnership between local businesses and the government to provide the money and payment plans.""Really?" questions Sharif. "Incentives are great, but I think that would send the wrong message to kids. There are othergood reasons for doing well in school. Money isn't everything, you know.""But it sure does help. I mean, anything that enables kids to learn more is good, right?" responds Shantel."Well, to undertake such a program, the school would need to gather evidence to support the idea that money motivatesstudents to get better grades," says Mr. Seemy. "Shantel, do you think you can prove you're right?""I'm sure of it. I'll survey everyone in 8th grade," replies Shantel, "and my evidence will show that money is the mostimportant reason students are motivated to get good grades.""I'll work with you, just to make sure you report your data accurately!" says Sharif.Shantel and Sharif's surveyStudent SurveyResponses(Total = 150)To me, the most important reason for getting good grades is...A Having my friends think I'm smartB. Getting approval/privileges (not money) from my parentsC. Being able to get a good job/get into a good college 20Getting money so I can buy stuffFeeling good about myselfB co806040D.E.AAE How did some Islamic groups respond to the presence of US troops in Saudi Arabia before September 11, 2001?a. They joined forces with the Saudi government.b. They asked for US support to take over Saudi Arabia.c. They demanded that the US withdraw its forces.d. They asked for US support to help take over Iraq. i need some real help pleas click on i have no clue i dont know spanish Producers _____.cannot make their own foodget their energy from the sunrelease carbon dioxide as a waste product of photosynthesistransfer 100 percent of their energy to the consumers that eat them Answer the question, don't mind the highlighted one A tuba can weigh up to 35 pounds. A tuba is the lowest-pitched brass instrument. write 1.8610 as an ordinary numbe good evening! Can someone please answer this, ill give you brainliest and your earning 50 points. Would be very appreciated. Initially, a ball has an angular velocity of 5.0 rad/s counterclockwise. sometime later, after rotating through a total angle of 5.5 radians, the ball has an angular velocity of 1.5 rad/s clockwise. what is the angular acceleration? write the sentences in the passive voice Lucy didnt send the invitation cards yesterday.