Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Do com.. Plete. 

 

* File Edit Selection View Go
Terminal Help
• PSP4.java - Visual Studio Code
Run
O PSP4.java 2
C> Users > nash1 > Desktop > ITSC1212 > O PSP4.java > s PSP4 > O solveQuadratic(double, double, double)
public class PSP4 {
private String name;
1
public PSP4(String name){
this.name - name;
3
4
}
6.
Run | Debug
public static void main(String[] args) {
PSP4 p - new PSP4("Chris Nash"); // Task 5: replace your name here
7.
9.
10
A
// Task 2: Create solution1 variable (need to be correct data
// type) and assign with the returned value of solveQuadratic
// method with inputs of 1, -4, 4 using p. Then print out a message
// "Solution for the quadratic equaltion of (1, -4, 4) is [solution1]"
11
12
13
14
15
16
17
// Task 3: Re-try task 2 with different values (1, -9, 9)
18
19
// Complete task 4 for this following line. This should print out the
// description instead of address memory
20
21
System.out.println(p);
}
22
23
24
public double solveQuadratic(double a, double b, double c)k
// Task 1: ax^2 + bx + C = 0 can have 0, 1, or 2 solutions
// depending on (a, b, c) values. In this practice, we follow
// an instruction to get a solution of the equation assuming
// the equation has at least 1 solution. The step (you need to
// choose correct data type for the following variables):
25
26
27
28
29
30
31
//
1. Compute delta which equals square root of (b^2
4ac)
32
//
Hint: Check out methods in Math for square root
math.sqrt(pow(b,2)- 4*a*c);
2. Compute the solution equals (-b + delta) divided by 2a
This is the largest solution of the 2 solutions
22
33
34
//
35
//
36
37
//
3. Return the solution
38
39
return 0.0;
// return e for compilation now, delete when done
40
41
// Task 4: describe PSP4 using tostring method, so we don't print
// out the address. Please describe in your word with the name field!
42
43
44
//
Hint: Use tostring method
45
46
47
48
Transcribed Image Text:* File Edit Selection View Go Terminal Help • PSP4.java - Visual Studio Code Run O PSP4.java 2 C> Users > nash1 > Desktop > ITSC1212 > O PSP4.java > s PSP4 > O solveQuadratic(double, double, double) public class PSP4 { private String name; 1 public PSP4(String name){ this.name - name; 3 4 } 6. Run | Debug public static void main(String[] args) { PSP4 p - new PSP4("Chris Nash"); // Task 5: replace your name here 7. 9. 10 A // Task 2: Create solution1 variable (need to be correct data // type) and assign with the returned value of solveQuadratic // method with inputs of 1, -4, 4 using p. Then print out a message // "Solution for the quadratic equaltion of (1, -4, 4) is [solution1]" 11 12 13 14 15 16 17 // Task 3: Re-try task 2 with different values (1, -9, 9) 18 19 // Complete task 4 for this following line. This should print out the // description instead of address memory 20 21 System.out.println(p); } 22 23 24 public double solveQuadratic(double a, double b, double c)k // Task 1: ax^2 + bx + C = 0 can have 0, 1, or 2 solutions // depending on (a, b, c) values. In this practice, we follow // an instruction to get a solution of the equation assuming // the equation has at least 1 solution. The step (you need to // choose correct data type for the following variables): 25 26 27 28 29 30 31 // 1. Compute delta which equals square root of (b^2 4ac) 32 // Hint: Check out methods in Math for square root math.sqrt(pow(b,2)- 4*a*c); 2. Compute the solution equals (-b + delta) divided by 2a This is the largest solution of the 2 solutions 22 33 34 // 35 // 36 37 // 3. Return the solution 38 39 return 0.0; // return e for compilation now, delete when done 40 41 // Task 4: describe PSP4 using tostring method, so we don't print // out the address. Please describe in your word with the name field! 42 43 44 // Hint: Use tostring method 45 46 47 48
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Module hierarchy chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education