Checkpoint 3.59 Assume the variables name1 and name2 reference two different String objects, containing different strings. Write code that displays the strings referenced by these variables in alphabetical order. System.out.println(name1); System.out.println(name2); } else { System.out.println(name2); System.out.println(name1); } Fill in the blank. + namel + alphabetically.");| + comes before
Q: a switch statement that checks origLetter. If 'a' or 'A', print "Alpha". If 'b' or 'B', print…
A: I have provided a detailed code below.
Q: 1. Write a regular expression to find the set of all strings with two consecutive repeated words…
A: Given: 1. Write a regular expression to find the set of all strings with two consecutive repeated…
Q: 2. Write a JAVA program to input 2 strings, s1, and s2, return a new string made of the first char…
A:
Q: 1. Using FLEX, write a program that works like a letter generator. The program must start by reading…
A: similar/same code given in step 2: Explanation: The accompanying flex input indicates a scanner…
Q: Two words are anagrams of each other if they contain the same letters in them. So left is an anagram…
A: The solution to the given problem is below.
Q: 2.2 Identify the errors in the code below and re-write the correct program. Import…
A: Line Number Error Correction 1 Import import 1 JOptionpane JOptionPane 3 string String 5…
Q: 2. Write a Java program that reads user input character by character until a sentinel value of. Is…
A: As per the given problem, we have to design a Java program that does the following : Keep reading…
Q: 49- Find the output of the following program. main(){ int a = 10, b, c; = a++; %3D C = a; %3D cout…
A: The correct option is option 3rd that is 11 10 11
Q: word and check whether that word is a palindrome or not. A palindrome is a string that is spelled…
A: import java.util.*; class Main { public static void main(String args[]) { String…
Q: 27. Rewrite the programs TestBreak and TestContinue in Listings 5.12 and 5.13 without using break…
A: Without using break Program Approach: Declaring the class TestBreak Defining the main method…
Q: 7. Suppose so and sɔ are two strings. What is the result of the following code? $6.equals(s5) ==…
A: 16)CS103 17) true 18) PROGRAM 19) B=3<<2 0011=3 C=5>>3 0101=5
Q: 49- Find the output of the following program. main(){ int a 10, b, с; = a++; C = a; cout << a <« “ «…
A: int a=10,b,c; means a=10 and a=b means b=10 and a=c means c=10
Q: Use java to write a program which stores the string value “TREBOR EVIL NO WARTS” using a…
A: - We need to create a java program to provide the asked output using StringBuilder class.
Q: Why does the following Python expression evaluate to False? 'FUN' == "fun" a. Because two strings…
A: In python string can be declared using single quote or double quote
Q: Q.2/ Write a program to transforms the Cartesian coordinate (x,y) presentation to the polar…
A: the program is an given below :
Q: 4. Write an algorithm that reads two values, determines the largest value and prints the largest…
A: Algorithm is a step-by-step procedure to solve a particular problem. The algorithm gives the logic…
Q: # Exercise 1: Ask for a birthday, a favorite gift, and their dream job is and display = that…
A: I have provided PYTHON CODE along with SCREENSHOT OF CODE WITH OUTPUT-----
Q: 2. Write a program that asks the user to enter a year, and then displays whether that year is a leap…
A: As per our guidelins we are allow to provide only one solution, please upload rest of them sepratly…
Q: 3.6 Write a program that resembles a phone book, which stores and displays the names, the addresses…
A: #include<stdio.h>//declaring structure for phone booktypedef struct phonebook{ //data members…
Q: Python 3.7.4: Write a loop that reads strings from standard input, where the string is either "duck"…
A: Following are some error in given code:There is not requirement to add countWrong expression in…
Q: 3. Write down a program that will take a string as input and will check whether this is a palindrome…
A: a. Using Library functions The programming methodology is given by: including header files main…
Q: Biologists use a sequence of letters A, C, T, and G to model a genome. A gene is a substring of a…
A: Programming Language : Python #prompt and read the genome from the usergenome=input("Enter the…
Q: Q5. a) Write a java program to demonstrate the use of mutable objects to find the Perimeter of a…
A: class Rectangle { // property of rectangle class int length,breadth; //Constructor…
Q: 7. Write a program which checks whether a given string is a palindrome or not. Note: A palindrome is…
A: Given:
Q: 21.4 LAB: Parsing dates (Use Python) Write a program to read dates from input, one date per line.…
A: Here in the main block, I have created an infinite while loop. Next inside the loop, I have taken…
Q: 2.4. Write a JAVA program to read input a string from the user and print it 5 times in the output in…
A: Here I have taken input from the user and then stored it into a variable. Next, I have used a for…
Q: Q.2/ Write a program to transforms the Cartesian coordinate (x,y) presentation to the polar…
A: Note : Answering in python as no language is mentioned. Input : Input x and y Output : Theta and…
Q: 23. Write a JAVA program that reads a multi-word string from the user and prints the string in…
A: Write a JAVA program that reads a multi-word string from the user and prints the string in reverse…
Q: 1. Reading the following program and write the running results. public class Addition{ public static…
A: According to the question this program taking the length of all array and show it on the output…
Q: 1- Write a java Program to read a numberfrom userand print full pyramid using numbers which will…
A: A program using JOptionPane class to read the number and print the pyramid. Code for Java program…
Q: (3) Implement the GetNumOfNonWSCharacters() function. GetNumOfNonWSCharacters() has a constant…
A: Program to implement the function named GetNumOfNonWSCharacters(). This function has a constant…
Q: 1. Design a class, CipherDriver, that uses a repeating key to encode and decode a message read from…
A: import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.ArrayDeque;import…
Q: Exercise 1: Ask for a birthday, a favorite gift, and their dream job is and display that information…
A: Since programming language was not mentioned so, I chosen PYTHON . I have provided PYTHON CODE…
Q: Assume that name and age have been declared suitably for storing names (like "Abdullah", "Alexandra"…
A: Actually, string is a sequence of characters.
Q: 6. (18) Write a Java program (18 = 3(a) + 2(b) + 3(c) + 3(d) + 3(e) + 4(f) a. Define 2 String…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: java
A: Program: //include the header fileimport java.util.Scanner;//definition of classpublic class…
Q: Consider the following single-quoted string literal: 'baby robot' What is the character at index 1?
A: here in this question we have given a string s='baby robot' and we have to find out what would the…
Q: 2. Write a JavaScript program to change the characters (lower case) in a string where a turns into…
A: To write javascript program to change the characters in a string where a turns into z, b turns into…
Q: 2. Write a java program which accepts a string from user and Apply translation operation and show it…
A: Given:
Q: Using any of the iteration structure, write a class that would display the following numbers…
A: import java.util.*;import java.lang.*;import java.io.*; class Codechef{ public static void main…
Q: 1) Write an appropriate java program that will: a. Return the length of the 4 strings. b. Compare…
A: As per our company guidelines, we are supposed to answer only one question per post and kindly…
Q: 5. Write a JAVA program to input a single line sentence from the user and find the sum of all the…
A: Calculate the sum of all the integers in a string that contains alphanumeric characters. Sample:-…
Q: 5. Consider a triangle with vertices at (0,0), (1,0), and (0,1). Write a function with header [S] =…
A: PROGRAM: function [S] = myInsideTriangle(x,y) %Initializing first vertex x1=0; y1=0;…
Q: 3: 1)Make a program that displays the states in the U.S one by one. 2) Display all states starting…
A: Use this screen for indentation :
Q: a. Which class is used to deal with the string subscript out of range. b. Which class is used when a…
A: a) out_of_range class is used to deal with the string subscript out of range.
Q: Task 2 Design and implement an ARMV8 program that counts total number of uppercase letters,…
A:
Q: Many user-created passwords are simple and easy to guess. Write a python program that takes a…
A: Algorithm: 1. Start. 2. Read user's password as word. 3. Define empty string as password = "". 4.…
java
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- T/F 3) The parameter (String[ ] variable) is used in a Java key method such that a user may run the software and supply "command-line" parameters. The operator, on the other hand, does not need to have any parameters since the parameter is a String sequence.Rest of code in image / This is a bad programming style since it is using goto. // This is an spagetti code and not working.// Use function to display menu, and display game rules,// Use different color for text display.// fix it so it works any way you like./*HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // Write 16 lines in 16 different colors. for (int color = 0; color < 16; color++) { SetConsoleTextAttribute (screen, color); cout << " Hello World!" << endl; Sleep(400); // Pause between lines to watch them appear } // Restore the normal text color) SetConsoleTextAttribute(screen, 7);*/#include <iostream>#include <windows.h>using namespace std;int main(){ //textbackground(WHITE); //textcolor(RED); system("cls"); char ch, a[20], ch2; int num = 100, rnum, guess, count, ch1, c = 0; cout << "**********************************************************"<<endl; cout << "*…//Assignment 06 */public static void main[](String[] args) { String pass= "ICS 111"; System.out.printIn(valPassword(pass));} /* public static boolean valPassword(String password){ if(password.length() > 6) { if(checkPass(password) { return true; } else { return false; } }else System.out.print("Too small"); return false;} public static boolean checkPass (String password){ boolean hasNum=false; boolean hasCap = false; boolean hasLow = false; char c; for(int i = 0; i < password.length(); i++) { c = password.charAt(1); if(Character.isDigit(c)); { hasNum = true; } else if(Character.isUpperCase(c)) { hasCap = true; } else if(Character.isLowerCase(c)) { hasLow = true; } } return true; { return false; } }
- True or False _(1) The expression n/3*(8+4) evaluates to 16 if n=4 ___(2) x is greater than both y and z can be written as the statement x>y&&z ; in Java. ___(3) In Java a string is automatically an object.def swap_text(text): Backstory: Luffy wants to organize a surprise party for his friend Zoro and he wants to send a message to his friends, but he wants to encrypt the message so that Zoro cannot easily read it. The message is encrypted by exchanging pairs of characters. Description: This function gets a text (string) and creates a new text by swapping each pair of characters, and returns a string with the modified text. For example, suppose the text has 6 characters, then it swaps the first with the second, the third with the fourth and the fifth with the sixth character. Parameters: text is a string (its length could be 0)Return value: A string that is generated by swapping pairs of characters. Note that if the Examples: swap_text ("hello") swap_text ("Party for Zoro!") swap_text ("") def which_day(numbers): → 'ehllo'→ 'aPtr yof roZor!' → '' length of the text is odd, the last character remains in the same position.Welcome Assignment ### welcome_assignment_answers ### Input - All eight questions given in the assignment. ### Output - The right answer for the specific question. def welcome_assignment_answers(question): # The student doesn't have to follow the skeleton for this assignment. # Another way to implement it is using "case" statements similar to C. if question == "Are encoding and encryption the same? - Yes/No": answer = "The student should type the answer here" elif question == "Is it possible to decrypt a message without a key? - Yes/No": answer = "The student should type the answer here" return (answer) # Complete all the questions. if __name__ == "__main__": # use this space to debug and verify that the program works debug_question = "Are encoding and encryption the same? - Yes/No" print(welcome_assignment_answers(debug_question)) As you can see, the first two questions are already in the skeleton code. Please follow the first two questions…
- // SuperMarket.java - This program creates a report that lists weekly hours worked // by employees of a supermarket. The report lists total hours for // each day of one week. // Input: Interactive // Output: Report. import java.util.Scanner; public class SuperMarket { public static void main(String args[]) { // Declare variables. final String HEAD1 = "WEEKLY HOURS WORKED"; final String DAY_FOOTER = " Day Total "; // Leading spaces are intentional. final String SENTINEL = "done"; // Named constant for sentinel value. double hoursWorked = 0; // Current record hours. String hoursWorkedString = ""; // String version of hours String dayOfWeek; // Current record day of week. double hoursTotal = 0; // Hours total for a day. String prevDay = ""; // Previous day of week. boolean done = false; // loop control Scanner input = new…Palindrome Checkercreate a JavaScript program that checks if phrasesentered by the user are palindromes. A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as “SIR”,“raceBIKE”, “Never odd or even”, “20/1/20”. The program should prompt the user to typein a phrase that is at least three characters long, and then tell the user whether the phrasewas a palindrome. Note, the decision should be based solely on letters and numericaldigits, and so it should not consider other characters, such as spaces or exclamationmarks, even though these might be entered by the user. when checking palindromes.A. Select your test data with care. Both palindromes and non-palindromes would be included in this. Provide examples that are text, numeric, and mixed; ignore any additional characters and spaces; andB. Ask the user for the word and then read their input. To verify that their input string has been read correctly, test this by displaying…Fix all the errors and send the code please // Application looks up home price // for different floor plans // allows upper or lowercase data entry import java.util.*; public class DebugEight3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); String entry; char[] floorPlans = {'A','B','C','a','b','c'} int[] pricesInThousands = {145, 190, 235}; char plan; int x, fp = 99; String prompt = "Please select a floor plan\n" + "Our floorPlanss are:\n" + "A - Augusta, a ranch\n" + "B - Brittany, a split level\n" + "C - Colonial, a two-story\n" + "Enter floorPlans letter"; System.out.println(prompt); entry = input.next(); plan = entry.charAt(1); for(x = 0; x < floorPlans.length; ++x) if(plan == floorPlans[x]) x = fp; if(fp = 99) System.out.println("Invalid floor plan code entered")); else { if(fp…
- Java : Write a function, that generates a random password. It will return the randomly generated password as its ONLY result. Password Criteria:1. The password should have a random length of between 4 and 7 characters. 2. it may contain all letters Upper and lower case2. A password is called STRONG if it holds all of the following properties: (a) It has at least 8 characters (b) It contains at least one lower case letter, and at least one upper case letter (c) It does not contain any blank space Write down a program that will take a password as input to a string and will print a message indicating whether it is STRONG or WEAK. Sample input: Strange Sample output: The password is WEAK solve in C program languageDebugEight4: Here is the code that needs to be debugged, I fixed some but it will not display the words in reverse at the end: // Application allows user to enter a series of words // and displays them in reverse order import java.util.*; public class DebugEight4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x = 0, y; String array[] = new String[100]; String entry; final String STOP = "XXX"; StringBuffer message = new StringBuffer("The words in reverse order are\n"); System.out.println("Enter any word\n" + "Enter + STOP + when you want to stop"); entry = input.next(); while(!(entry.equals(STOP))) { array[x] = entry; ++x; System.out.println("Enter another word\n" + "Enter " + STOP + " when you want to stop"); entry = input.next(); } for(y = x - 1; y > 0; ++y) {…