# AP Comp Sci Principles Unit 5:create Performance Task Project - AP Comp Sci Principles - Assignment

583 words - 3 pages

Part a
Video is attached with narration
Part b
The purpose of my program is to help solve quadratic equations. I faced some difficulties along
the way as I pursued this purpose. For example, often times my solution methods were
returning “NaN”. I initially attempted to solve this by writing out the formula and making sure the
parentheses were grouped correctly. I ended up collaborating with one of my classmates to
determine why sometimes the solution was correct and other times it returned “NaN. I
determined that it returned “NaN” when the solutions were not real. After figuring out the
problem with the help of a partner, I independently learned about exceptions and how to “throw”
and “catch”. Using this new knowledge of exceptions, I was able to handle non-real solutions.
Initially, my problem was not user interactive. I learned about the Scanner class and saw the
opportunity to add a user interaction part to it to make it more friendly. I also saw many
opportunities to use abstraction such as when finding the solutions, I did not need to reprogram
the discriminant aspect of the quadratic formula. Instead, I just called the discriminant method of
my class.
Part c
public double getFirstSolution() {
double firstxsolution;
double discriminant = getDiscriminant();
if(discriminant<0) {
throw new IllegalArgumentException("The discriminant is negative. There
are no real solutions");
}
double root = Math.sqrt(discriminant);
firstxsolution = (-b + root)/(2*a);
return firstxsolution;
}
This is my algorithm to get the first solution of the quadratic equation. It works by using the
discriminant method of my class and using the Math class for some operations. First, I call the
getDiscriminant() method and store the value of b^2 - 4ac in a variable. This part of the
algorithm simplifies the rest of the calculations. It then checks if the discriminant is negative to
determine if the solutions are valid or not. If the solutions are invalid, it handles this by throwing
an exception. Otherwise, it calculates the square root of the discriminant using the Math class’
sqrt method. Then, it manipulates this square root value by adding it to negative b and dividing
the quantity by 2 * a, completing the quadratic formula. This algorithm is the primary algorithm
used in the program as the program’s intended purpose is to provide the solutions for a
quadratic equation. The mathematical concepts that it integrates are those of the square root
which is found using the Math.sqrt, unreal values which are accounted for in the if statement,
and the quadratic formula, which is the entire algorithm.
Part d
public double getDiscriminant()
{
double Discriminant = Math.pow(b, 2) - (4 * a * c);
return Discriminant;
}
Here is an example of an abstraction that I used in this program. I found that I often repeated
the procedure for finding a discriminant and that a user may even need to find only the
discriminant so I created a getDiscriminant() method in order to avoid repeating my code. This
method is not only called by both of the getSolution methods but also by the user if they need to
find the discriminant. It simplifies my code because it is easier to read when the getDiscriminant
method is called instead of the formula being written out. It also removes repetition. The method
works by using the Math class’s pow method to square the value of b. Then from that value, it
subtracts the quantity of 4ac which is the formula for the discriminant of a quadratic equation.

## Moral Dilemma Of Computer Science & Government - TAMU Comp Sci - Short Research Assignment

489 words - 2 pages ... Name a) My dilemma is one that happened between Apple and the FBI in 2015. There was a dispute between the two organizations over the unlocking of an iPhone 5C, specifically, the one used by one of the terrorists involved in the San Bernardino shooting. The FBI tried to force Apple to create a special OS that would allow them to unlock the phone without the password. Apple declined to do so because doing this would violate their policy of not ...

## Survey Of US History C121 WGU Task 5 - Western Governors University C121 US History - Performance Assessment-essay

421 words - 2 pages Free ... Sara Layland Professor Kris Teters Survey of United States History 23 September 2018 C121 Task Five 1a.  The appeal for religious liberty by Isaac Backus, a leader of the Baptist Church, speaks about the reverend pioneering the idea of keeping religious matters out of government positions; particularly in positions where authority is present over tax-paying townsmen (Backus, 1999). 1b.  During this time, taxes were imposed on New Englanders some ...

## Addicted To Dance The Love Of My Life - Ap Lang And Comp - Essay

830 words - 4 pages ... Kendal Suchanek September 24, 2018 Ap Lang and Comp Addicted It’s guilty desire, something you could not live without. You never can have enough, never will you be fulfilled. Addiction, it’s a love hate relationship. As convincing as it sounds, putting my life on the line, shooting god knows what in my arms, I truly consider that dancing a my drug running through my body. Never will I get enough. Would it be immoral to say dancing is my life ...

## Victorian Era Literature Unit Test - AP English Lit. - Assignment

744 words - 3 pages ... Leslie Doria AP Eng.lit Graded Assignment Victorian Era Literature Unit Test, Part 2 In this section, you'll have 40 minutes to develop an essay response to the following prompt. Complete this teacher-scored portion of the Unit Test, and submit it to your teacher by the due date for full credit. Essay (80 points) Bessie sings the poem shown below to the youthful Jane Eyre, after which Jane sobs ...

## Training Methods And Principles - 10 Aqua - Assignment

463 words - 2 pages ... Training Methods & Principles Principles · Progressive overload Progressively challenge the body so that it will continue to make changes to cope with the new demands (thus increasing fitness) If training remains the same for 6 months fitness level will not keep increasing, but remain at a constant level · Specificity Fitness is specific- adaptations from training will be directly related to the type of training undertaken Training programs must ...

## Four Principles Of Interpersonal Communication - Communications - Assignment

656 words - 3 pages ... The Four Principles of Interpersonal Communication Four Principles of Interpersonal Communication These principles underlie the workings in real life of interpersonal communication. They are basic to communication. We can't ignore them. Interpersonal communication is inescapable We can't not communicate. The very attempt not to communicate communicates something. Through not only words, but through tone of voice and through gesture, posture ...

## AP European History Unit 1 Corrections - Chaska Middle School; AP European History - Test Corrections

2703 words - 11 pages ... Unit 1 Test Correction From the beginning of the Middle Ages to the end of Martin Luther’s Reformation, there were countless changes that occurred in the religious, social, political, and economic areas of European life. These changes could have destroyed certain ideas while other changes created new ones. More often than not, these areas of influence affected one another and created situations that benefited some while harming others. An ...

## Personality Project On What Our Personality Is - Ap Psychology - Essay

1400 words - 6 pages Free ... Lau 1 Tammy Lau Mrs. Nelson AP Psychology, Period 4 30 March 2018 Personality Project In order to figure out our personalities and who we are as an individual, we use personality theories, such as psychodynamic and psychoanalytic, humanistic, trait, social-cognitive, and positive psychology, to determine it. Psychoanalytic and psychodynamic puts emphasis on our childhood memories and how our unconscious mind functions. Humanistic theories focus ...

## The Tsunami On A Lake, A Short Story - Cherokee/american Lit/comp - Homework Assignment

581 words - 3 pages ... Brubaker 1 Sean Brubaker Mrs. Mullett American Lit/Comp 5 June 2018 The Tsunami on the Lake It was a beautiful, clear sky Tuesday in good ole rural North Carolina when everything started falling apart, quite literally. On the side of the road stood two young men, one short and red-haired and the other who was tall, muscular, and completely gray-haired. They were examining their trailer’s shredded wheel, and they had no idea what to do since they ...

## Ap Human Geography Module 5 Lesson 8 Essay - Virtual School - Essay

909 words - 4 pages ... Assignment 5.08 Does every religion have the potential to become a global religion? Or are some religions destined to remain local? “‘[Globalization can be defined as a process of an “ever more interdependent world’ where ‘political, economic, social, and cultural relationships are not restricted to territorial boundaries or to state actors,’ globalization has much do with its impact on cultures.”(Golebiewski, 2014) Every religion has the ...

## “the Death Of The Moth” Questions -AP Lang.docx - AP Lang - Assignment

552 words - 3 pages ... Chris Moon Mrs. Cmaylo Per 5; AP Lang 1/16/2017 Focus Work: “The Death of the Moth” What effect is Woolf striving for? In “The Death of the Moth”, Virginia Woolf is striving for the effect of making the reader contemplate about the relationship between life and death, and how one should view it. How does she create that effect? Woolf creates this effect by implementing rhetorical devices such as imagery and by creating a calm and observative ...

## Unit 3- Digital Graphics Task 2-file Formats - Ifield Community College, 13d/it1 - Assignment

1131 words - 5 pages ... Hajid Hussain 13B-It1 Monday, 16 April 2018 Unit 30- Digital Graphics Task 2- File Formats In this task I have been asked to explain the different types of graphic images and how they relate to file formats. Then I must discuss the impact that file format, compression, resolution, and colour depth have on file size and image quality. Bitmap- Let me begin with explaining on how different types of graphic images relate to file formats and starting ...

## AP World History Myans And Aztecs - AP World History - Homework Assignment

991 words - 4 pages ... the Christian leaders. Cities continued to grow and urban economies continued to be born and this enhanced the commercial side of the West. The Church has accepted the principles of capitalism as profit seeking. Technology continued to advance especially in ironwork used for bells and weapons and timekeeping. 5. How did the Renaissance affect and benefit European society? The Renaissance was significant on the development of Western Europe and ...

## An Assessment Of Project Management Processes: London Heathrow Terminal 5 - RMIT - Assignment

1521 words - 7 pages ... an incentive mechanism to encourage innovation and problem-solving among integrated suppliers team, thus ensure a high standard performance on budget and on time. Reference list Broughton, T 2004, ‘T5 a template for the future: how Heathrow Terminal 5 has rebuilt the building industry’, Supplement within Building, 27 May. Carlos, E & Milton, F 2014, ‘When do megaprojects start and finish? Redefining project lead time for megaproject success ...

## AP US Outlines Chapters 1 And 2 - US History - Assignment

5767 words - 24 pages ... clan. 3. The cultures of these eastern peoples were diverse; however, European diseases killed thousands of them in the 1540’s and the survivors had to live in smaller and smaller communities. 4. In these societies, like many others in different regions, the men hunted and fished while the women raised corn, squash, and beans. a. A matrilineal system of kinship developed as a result. 5. Religious rituals centered on agriculture and populations ...
Other Popular Examples