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
Question
In Java:
Write a
Ex: If the input is:
5 hey hi Mark hi mark
the output is:
hey 1
hi 2
Mark 1
hi 2
mark 1
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
/* Type your code here. */
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 4 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
- Many user-created passwords are simple and easy to guess. Program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "q*s" to the end of the input string. i becomes ! a becomes @ m becomes M B becomes 8 o becomes . Ex: If the input is: mypassword the output is: Myp@ssw.rdq*s IN JAVA. USING LOOPSarrow_forwardJava - Insect Growtharrow_forwardWrite the following programs in Java: In the Converter class write the static method, bin2decimal(String bin). The parameter for this method is an unsigned (nonnegative) binary number represented by a string. The method returns the decimal equivalent for the binary parameter, as an integer.If the binary string is invalid (contains characters other than ‘0’ and ‘1’), the method returns -1. Convert from a binary (b) string with up to 16 digits to decimal (d) using the following formula:? = ?0 + ?1 × 2 + ?2 × 22 +⋯+ ?7 × 215where b0, b1, ?2, … ?7 are the binary digits in order of increasing significance. For example, 1101 is: 1 + 0×2 + 1×22 + 1×23 = 13 in decimal. Side note: You may NOT use the decode method of the Long wrapper class instead of this formula. In the Converter class write another static method, english2encrypted(String english). The parameter for this method is a word or sentence represented by a string. The word or sentence should only contain letters (no digits,…arrow_forward
- Java, the user selects an item from the text files ranging 1-15, repeats the loop until 'q'. the program provides a list of what they ordered including discounts, then calculates the total bill and how much they saved. The bottom is my the code I'm working on class BillProcessor {public static void prepareBill(LinkedHashMap<String, Integer> purchases, LinkedHashMap<String,Double>items,LinkedHashMap<String,String> sales, ArrayList<String> itemNames){double totalCost, totalDiscount, actualCost, discount; //note actualCost is the price of a single itemtotalCost = 0.00;totalDiscount = 0.00;actualCost = 0.00;discount = 0.00;for(Map.Entry<String,Integer>set: purchases.entrySet()) {if (sales.get(set.getKey()) != null) {if (sales.get(set.getKey()).equals("bogo") == true) {actualCost = set.getValue() * items.get(set.getKey());totalCost += actualCost;System.out.println("Item Name : " + set.getKey() + "\tItem Quantity(bogo) : " + (set.getValue() * 2 + "\tItem Cost :…arrow_forwardWrite a Java program that will use while loops. The while loop will show the cards currently in the hand and ask the user to accept a card (Hit) or to stop (Stand). Within the while loop the program should print the card that was just added, all the cards in the hand, and the new value of the hand. If the value of the hand exceeds 21, the game should end (the while loop should stop). Write out the algorithm for the while loop. Turn in a printout of the algorithm, the code and a printout of a sample run. Place the algorithm and the sample run inside comment blocks in the code. "The sample runs of such a program are on the attached image."arrow_forwardWrite a Java Program to take a string from the user and Your task is to find the length of longest palindrome string that can be made from that string.arrow_forward
- Write in JAVAarrow_forwardIn Java Integer in is read from input. Write a while loop that iterates until in is less than or equal to 0. In each iteration: Update in with the quotient of in and 7. Output the updated in, followed by a newline. Click here for exampleEx: If the input is 2401, then the output is: 343 49 7 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import java.util.Scanner; public class QuotientCalculator { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); intin; in=scnr.nextInt(); /your code here/ } }arrow_forwardPlease solve this in Java Thankarrow_forward
- Write a program in Java to count the total number of vowels and consonants in a String. The string can contain all the alphanumeric and other special characters as well. However, only the lowercase English alphabets are allowed in the String.arrow_forwardPrint the two strings, firstString and secondString, in alphabetical order. Assume the strings are lowercase. End with newline. Sample output: capes rabbits 1 import java.util.Scanner; 2 3 public class OrderStrings { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); String firstString; String secondString; 4 6 7 8 firstString secondString scnr.next(); scnr.next(); 9. 10 11 12 /* Your solution goes here */ 13 14 } 15 }arrow_forwardIn Java: Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9. Ex: If the input is: 1995 the output is: yes Ex: If the input is: 42,000 or 1995! the output is: no Hint: Use a loop and the Character.isDigit() function.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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