Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

In java just add code between the comments

public class A6 {

/**
* In this Java file, you will write three methods that will ensure that the calls in the main methods are
* properly executed. You do NOT have to change anything in the main() method. You have to write the methods that
* will complete the program.
*
* Pay attention to the method name, the method return type, and the method parameters.
*/
public static void main(String[] args) {

/*Your first method will ask user to enter two values and return the exponent where the first
number will be the base and the second will be the exponent. Remember to use a mathematical function.
If the user enters value 1 as 2 and value 2 as 3, output of your method should be 8 (2 raised to power 3)
*/
double calculatedExponent = exponentCalculator();
System.out.println(calculatedExponent); //this should print out the exponent value

/* Your second method will have two parameters. The first is a String and the second is a number. The method
should return the character at that position of the string. E.g.,
charAtPosition("Hello", 1) should return 'e'
The count begins at 0. If the number is greater than the length then your method should print an message
saying it is an invalid number.*/
char charFound = charAtPosition("This is a random string", 5);
System.out.println(charFound); //to help you test: this should print out 'i'.



// Your third method will check if a string contains one of multiple numbers and return true if it does.
// E.g., hasNumber("hello123") should return true but hasNumber("hello") should return false.
boolean numberFound = hasNumber("CSC210");
System.out.println(numberFound); //to help you test: this should print out true
}


/**
* Below this, write your methods. Remember to put proper comments where necessary.
*
* Again, pay attention to the method name, method return type, and method parameters. You do NOT have to change
* anything in the main method above.
*
* Tip: read the main method carefully to understand what the method name should be and what paramaters it should
* have. To find the return type, look at the variable that is going to store whatever value your method returns.
*
* Second tip: to test each of your method, comment out the other lines that you see. For example, to test
* exponentCalculator() method, comment out lines 22, 23, 29, and 30. To test charAtPosition method, comment out
* lines 14, 15, 29, and 30. To test hasNumber method, comment out lines 14, 15, 22, 23.
* To comment out means adding // before the line.
* Critical: remember to uncomment the commented out lines before submitting. Uncomment means deleting the // that
* you may have added.
*
*/

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education