Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).
Then create a new Java application called "CharCounter" (without the quotation marks) that gets two Strings called inputEntry and inputCharacter from the user at the command line. Allow for the inputEntry String to be one or more words of input. Check that the inputCharacter String has a length of 1 and note these validations:
- If it doesn't, provide the user with suitable feedback and conclude the
program. - If the inputCharacter length is valid (i.e., it has a length of 1), use a while loop to check each position in the inputEntry variable and return the number of times the character occurs. For example, if the inputEntry is "test" and the inputCharacter is "e" you would output: "There is 1 occurrence(s) of 'e' in test."
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images
Knowledge Booster
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
- Hello, I don’t understand this Java Question may someone help me out, may you also please type out the code please and take a screenshot ?arrow_forwardI'm working on an assignment and i'm trying to create a to-do list in AndroidStudio. I've created the listview, edit text, switch and button, but I've hit a snag with the following: Create a new Java object to hold each todo item, it should contain a string with the text of the todo, and a boolean for if it is urgent or not. Create a List to hold all your items, and for the adapter to use for displaying them. When you click “Add”, you should create a new todo item and add it to the list, clear out the text in the EditText, and call “notifyDatasetChanged()” on your adapter so it refreshes. Implement a BaseAdapter to power the ListView. In AndroidStudio, type ctrl + O (the letter ‘O’, not number zero). From the list of inherited functions, implement these ones: int getCount() - This returns the number of rows that will be in your listView. In your case, it should be the number of strings in the array list object ( return list.size() ). Object getItem(int position) – This…arrow_forwardFor activities with output like below, your output's whitespace (newlines or spaces) must match exactly. See this note. Write code that outputs variable num_baths as follows. End with a newline. Ex: If the input is 3, then the output is: Baths: 3arrow_forward
- In netbeans, Write a method named findLastTwoLetters that is passed a String parameter and that prints the last two letters of the string. For example, “ta” is returned if the parameter is “Roberta”. You are guaranteed as a precondition that the parameter will have a length greater than 1. This method can be completed using substring().arrow_forwardYou have to use comment function to describe what each line does import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class PreferenceData { private final List<Student> students; private final List<Project> projects; private int[][] preferences; private static enum ReadState { STUDENT_MODE, PROJECT_MODE, PREFERENCE_MODE, UNKNOWN; }; public PreferenceData() { super(); this.students = new ArrayList<Student>(); this.projects = new ArrayList<Project>(); } public void addStudent(Student s) { this.students.add(s); } public void addStudent(String s) { this.addStudent(Student.createStudent(s)); } public void addProject(Project p) { this.projects.add(p); } public void addProject(String p) { this.addProject(Project.createProject(p)); } public void createPreferenceMatrix() { this.preferences = new…arrow_forwardFor this problem, you are given a java code FlipAgain.java. Copy the .java file to your project folder. Open the file in your IDE. You have to edit this code to make it work. You can see that the code I have given you does not compile. So, you won’t be able to run it without fixing the code. Perform the following tasks in order. The code as given does not compile. Notice that the while loop tests if again.equals("y"), but the variable again doesn't have a value at first. Give it a value so that the code will compile and the loop will run at least once. Now that the program is working, change the loop from a while loop to a do-while loop. Make sure it still works. What happens if you delete what you added in step 1? Change the line back to just String again; Does the program still work? Why or why not? (Answer in a comment in the program.) After completing the above three tasks submit the final code, where you converted the while loop to do-while loop. FlipAgain.java ----->…arrow_forward
- In Java, create a user interface that has a top bar that includes a menu. The menu should have four items. When the user selects the first menu option, then the date and time should be printed in a text box. When the user selects the second menu option, then the text box contents should be written to a text file named "log.txt." When the user selects the third menu item then the frame background color changes to random color hue of the color green. The menu option should display the initial random hue each time selected for a single execution of the program. See https://www.w3schools.com/colors/colors_picker.asp When the user selects the fourth menu option then the program exits. Thank youarrow_forwardIn python: The program should ask users for their email address and password for connecting to the mail server. You can create a new gmail account and use it for this assignment. Once the connection is complete, the program should ask for the receiver''s email address, and lastly send the email. Write "Hello" for the subject and "Email from Python" as body. Use the getpass library to hide password from shell. Instantiate an object and call it. Submit the .py file as well as screenshots showing the code runs and email received.arrow_forwardYour class StringDoubling has a method doubleString(), which takes a String as an input parameter and returns the doubled copy of that string. Your task: Finish your main method by follow the steps outlined in your main (precisely!) Basically, your program should read in a command-line argument, print it out, and then double it 5 times (printing it out every time). For example, if your command-line value is 0, your program should output the following: 0 00 0000 00000000 0000000000000000 00000000000000000000000000000000 and if your command-line value is a, your program should output the following: a aa aaaa aaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrow_forward
- I was asked to add the three types of comments to this class, each consisting of the same statement (this statement is also printed once). The output/print, block comment, and single line comment has all been marked correct. The Javadoc comment, however, has not. I asked this question earlier and tried implementing that solution, however, it did not work. What should I do to make it work?arrow_forwardWrite a procedure that generates a drinking glass from a contour by creating a solid of revolution and saves it as data-files/model/glass.off. You may make a user interface for the contour parameters, but are not required to. Make a number box that selects the number of rotational slices and a button labelled “Generate” that launches the generator. Display a message on screen while generating and then flush the G3D::ArticulatedModelcache, and reload the current scene on completion. The glass must have nonzero thickness for the bowl part that contains the liquid. It cannot have any “exposed backfaces”. The glass must have a stem or thick base that is not penetrated by an inner well (i.e., you can't just double all surfaces). The glass must be geometrically closedand water tight (i.e., it should topologically be a sphere)arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education