Program
import java.util.Scanner;
public class FirstSecondNext {
public static void main(String[] args)
{
Scanner scanner = new Scanner(System. in);
System.out.print("Please enter a string, atleast 5
letters long : ");
String s = scanner. nextLine();
char first=s.charAt(0);
char second=s.charAt(1);
String
next=String.valueOf(s.charAt(2))+String.valueOf(s.charAt(3))+String.valueOf(s.charAt(4));
System.out.println("The first letter of s is "+first);
System.out.println("The second letter of s is
"+second);
System.out.println("The third,fourth and fifth letters
are "+next);
}
}
Output
Please enter a string, atleast 5 letters long : Saturday
The first letter of s is S
The second letter of s is a
The third,fourth and fifth letters are tur
In a file called First SecondNext.java, write a program that: • Asks the user to enter...
USING PYTHON PROGRAMING LANGUAGE Write a program that first asks the user to enter a “special” letter. The program should then ask the user to enter a single line sentence containing all lowercase letters and no punctuation, except for a period at the end. The program will then output the number of times that this letter appears in the sentence. Example: Enter a special letter: t Enter a sentence: here is my little sentence. Your letter appears 3 times. (t...
Objectives: Use strings and string library functions. Write a program that asks the user to enter a string and output the string in all uppercase letters. The program should then display the number of white space characters in the string. You program should run continuously until the user enters an empty string. The program must use the following two functions: A function called count_spaces that counts the number of white spaces inside a string. int count_space(char str[]); which tell you...
14.3: More Sentences Write a program that allows a user to enter a sentence and then the position of two characters in the sentence. The program should then report whether the two characters are identical or different. When the two characters are identical, the program should display the message: <char> and <char> are identical! Note that <char> should be replaced with the characters from the String. See example output below for more information. When the two characters are different, the...
Python: Write a program that lets the user enter a string and displays the letter that appears most frequently in the string, ignore spaces, punctuation, and Upper vs Lower case. Create a list to hold letters based on the length of the user input Convert all letters to the same case Use a loop to check for each letter in the alphabet Have a variable to hold the largest number of times a letter appears, and replace the value when...
I need Pseudocode Algorithm only, please Write a program that asks the user to enter the name of his or her favorite city. use a String variable to store the input. The program should display the following: The number of characters in the city name the name of the city in all uppercase letters the name of the city in all lower case letters the first character in the name of the city
Write a program that asks the user to enter 1000 integers to be stored in an array called "numbers". Since the same integer might occur (exist) in the array multiple times, your program needs to fill a second array, called "Isolate" that contains all the integers from the first array but NOT REPAPTED (every integer will exist only once). Finally, your program will print the integers of the second array sorted by occurrence (occurrence is: the number of times the...
Java Letter Counter: Write a program that asks the user to enter a string, and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the string. Must use a do while loop and a counter!!!!
Write a program that asks the user to enter a string and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the string. python programming
Write an assembler program that asks the user (as shown below) for two integers and a single character representing the arithmetic operations: addition, subtraction, multiplication and integer division (displays both quotient and remainder). Perform the requested operation on the operands and display the result as specified below. Assume SIGNED NUMBERS. The program should not divide by 0! If the user attempts to divide by 0, display the error message: "Cannot divide by zero." If this error occurs, the program should...
This program asks the user to enter a word. It then tries to create a string with the minimum number of repetitions of the word necessary to make a string of length at least 20. Right now, it ends up making too long of a string in certain cases. For example, if you enter a word with eight letters, like "computer", the result should only have three copies of the word in order to meet the length requirement of 20:...