Write a program that prints all letters that occur a single time in a string. For example, if the string is Mississippi, print M, and if it is Missouri, print Mour. Use nested loops to solve this problem.
Q: Write a program to compare two strings. Take both of strings from user and compare them. If equal…
A: #include <stdio.h> int compare(char[],char[]); int main() { char…
Q: Write a java program that uses nested for-loops to display a sequence of numbers. The program should…
A: Program:- import java.util.*;public class Main{ public static void main(String[] args) {…
Q: Write a program that reads in a line of text and replaces all four-letter words with the word…
A: String The string in the programming language is defined as the data type similar to the integer,…
Q: Write a program that checks matching words - First asks the user to enter 2 String variables word1…
A: Note: The program has been provided in Java. Java has two methods to compare strings.…
Q: Use nested loops to find all the three-digit Armstrong numbers and print those numbers. Armstrong…
A: public class Main{ public static void main(String args[]) { int num, start =100, end=999, i,…
Q: Implement the following: Write a loop that prints out the following numbers. Example Output 100 |…
A: Objective: This program prints a given number series. The series displays every number starting from…
Q: Here is a loop that starts with an initial estimate of the square root of a, x, and improves it…
A: Introduction This is for Python Please see attachment
Q: Please write a program that prints the woodchuck tongue twister when run with the given input…
A: This is very simple. I have written a simple code in python to perform the exact operations…
Q: Make a program that asks for random integers, positive or negative, and sums up all the negative…
A: Coded using C language.
Q: Write a program in Java using the for loop, the while loop and the do- while loop to print the…
A: public class Main{ public static void main(String[] args) { //n from 10 to 100 incrementing 10…
Q: Write a loop that iterates over a String s and counts, then prints the total number of x's plus y's,…
A: import java.util.*;public class Main{ public static void main(String[] args) { int countx=0;…
Q: Write a loop that iterates over a String t and counts, then prints the total number of a’s plus b’s,…
A: Task :- Write a program to count the number of a's , b's and c's count in string. (As programming…
Q: Write a program that reads a string using the function getline( ) or cin.get(). The program counts…
A: Algorithm: Start Read a string s Initialize count to 0 Iterate through the string If the character…
Q: Write a program using nested for loops that will print the table below exactly as shown: 10…
A: A variable, var, has been created of type int with initial value set to 10. Nested for loop is used…
Q: Write the method catDog
A: Programming approach Initialize the variables with 0 for keeping the count of the words “cat” and…
Q: Use a loop to track the growth of the Utopian Tree. The tree grows exactly 1 cm for the first three…
A: Answer is given below-
Q: Using the concepts you have learned about Strings, create a well- documented program that will give…
A: Using procedural approach. We are using String library in the util package. Using do while to…
Q: Find the attached file.
A: Note: Here you didn't mention any programming language so we using the C++ programming language to…
Q: Write a program that reads a string and checks the longest substring starting with "a" and ending…
A: I am using java language to solve the above problem. see below step
Q: Write a program that reads in five integers using loops and then determines and prints the largest…
A: Note: Since the language is not defined in the question, thus the question is answered in C++…
Q: Write a program that copies the following string into a destination string. Copy each letter in this…
A: PROGRAMMING LANGUAGE ==>> C++ I have provided C++ CODE along with CODE SCREENSHOT with…
Q: Write a program to: Store the following message into a string (DO include periods!): I am the door…
A: String functions like at(), replace() and append() can be used to solve this problem.
Q: python Write a loop that prints each country's population in country_pop. Sample output with…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.…
Q: 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42…
A: Rewrite the previous program by using while nested loop ? And the result must be as the following…
Q: Write a program that asks the user to enter an integer number and checks whether the number is prime…
A: #include <iostream> using namespace std; int main() { int n, i, m=0, flag=0; cout…
Q: Write java program Using for - loops, generate 10 random numbers between 10 to 30 inclusive. Find…
A: Ans -- a. use random in java to generate numbers inclusive to 10 and 30 b. initialise total as 0…
Q: Convert the following for-loop into an equivalent while-loop as closely as possible using the code…
A: The code is given below.
Q: run a loop for a from 0 to 9999 ● see (a+"").length() , if it is k, then add (4-k) zeores before…
A: We need to write a program for the given scenario. The language used is Java.
Q: Write a program that reads a series of strings and prints only those that end with the letters…
A: Let's say length of strings are 8. And we have to print all strings which are ends with letters…
Q: Write a java program that uses nested for-loops to display a sequence of numbers. The program should…
A: Code: import java.util.Scanner; public class MainClass { public static void main(String[] args) {…
Q: Q: Write a program in python that asks the user to enter a string, then prints out each letter of…
A: Note :- for better execution program use online IDE . In online IDE , if you get any…
Q: public class PS06B { /** * Write the method xyzMiddle(). * * Given a String str, does "xyz" appear…
A: 1. Store the index of "xyz" in a variable- i1. 2. Get the length of the part of the string which is…
Q: 1. Write a program that reads a number between 1,000 and 999,999 from the user, where the user…
A: As programming language is not defined , doing it in JavaFX GUI,
Q: Use a loop to print the alphabet from A to Z. Print all the characters in one line, with no spaces…
A: Java Program to print the the uppercase letters from A to Z, and a second line for the lowercase…
Q: In PYTHON, write a code that allows the user to input two non-negative number sequences in…
A: the answer is given below:-
Q: 1. Write a program that reads a number between 1,000 and 999,999 from the user, where the user…
A: Note: Since the given question is multiple one. We are advised to do first question. Kindly post…
Q: Use while loop in Java Language Write the method xyzMiddle(). * * Given a String str, does "xyz"…
A: Define class Main {} Define Boolean type of xyzMiddle() function with string as parameter. Convert…
Q: Write a program that asks a user to input the height of triangle and draw a triangle that has the…
A: Nested Loop: C allows loops to be nested. Nesting of loops is a C feature that allows statements to…
Q: Write a program that asks the user to enter an integer number and checks whether the number is prime…
A: Please find the answer below :
Q: Write a program that receives an integer input from the user and call it n. Use a for loop, an if…
A: According to the information given:- We have to follow the instruction in order to get desired…
Q: Write a program which reads string and rewrite it in alphabetical order. For example, the word…
A: code and output is in step2.
Q: Write a program that uses two nested for loops and the modulus operator (%) to detect and print all…
A: Dear Student, As no programming language is mentioned I am assuming it to be c++.
Q: 1. Write a Java program that will read numbers between 1 and 14 and will output the appropriate…
A: Here's the working code: import java.util.*;import java.lang.*;import java.io.*;public class…
Q: in python: Write a program that takes a date as input and outputs the date's season. The input is a…
A: PROGRAM STRUCTURE: Takes the value of month from the user. Takes the value of date from the user.…
Q: Write a program that reads in three strings and sorts them lexicographically. You can ask to enter 3…
A: public class Main { public static void main(String[] args) { String[] name = {…
Q: I need to write a palindrome Java program. Given a string of letters, it should find the minimum…
A: ANSWER: Palindrom: Program 1: Output:
Q: Write a program in C++ that uses for loops to perform the following steps: Prompt the user to input…
A: C++ program to get the two integers named firstNum and secondNum from the user. The firstNum must be…
Q: Write a program that gets a string from the user and reports whether or not there are repeated…
A: # Note: Since you have not mentioned the programming language, we will be answering this in python.…
Q: Write a java program that takes a string as input from the user and finds out if the string is a…
A: import java.util.*; public class Main { public static void main(String args[]) { String a, b = “”;…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- public String getJoblitle() { return joblitle; 11 12 13 44 45 46 47 48 49 50 public void setJoblitle(String joblitle) { this.jobTitle - joblitle; public int getCurrentEmploynent() { return currentEmploynent; 1. public void selCurrentEnployent (int current Fmployment) { this.currentEmploynent - currentEmployment; 53 54 55 56 -57 goverride public String tostring () { return "CurrentEmploynentStatsclass [areaName=" + arealame + 58 + "year=" + year + ", jobtitle-" + joblitle , currentEnploynent-" + currenttmployment + "]": 59 61 62 63 64 } What algorithm does this method perform? public statie Currentiploynentstatsclass mysteryethod (CurrentEmploynentstatsclass] array) ( int holder = array[0).getCurrenttmploynent(); Currenttmploynentstatsclass variable = array[®]; for(int i- 0, i holder) { holder = holderx; variable - array[1]; return variable; 36. What is the above method returning? 37. What is the Big O time of the above method?// DebugFive2.java // Decides if two numbers are evenly divisible import java.util.Scanner; public class DebugFive2 { publicstaticvoidmain(Stringargs[]) { int num; int num2; Scanner input =newScanner(System.in); System.out.print("Enter a number "); num = input.nextInteger() System.out.print("Enter another number "); num2 = inputnextInt(); if((num % num2 ==0) && (num2 % num) ==0) System.out.println("One of these numbers is evenly divisible into the other"); else System.out.println("Neither of these numbers is evenly divisible into the other"); } }public int getPowerUse(){ return super.getPowerUse() + contents * powerRating; //////////////////////////////////////////////// if (args[0].equals("REFRIGERATOR")) { String manufacturer = args[1]; String serialNo = args[2]; int basePower = Integer.parseInt(args[3]); int powerRating =Integer.parseInt(args[4]); int capacity = Integer.parseInt(args[5]); Refrigerator rf=new Refrigerator(manufacturer,serialNo, basePower, powerRating, capacity); things[rf.getId()]=rf; returnval = rf.getId(); }
- import java.util.Scanner; public class MealEstablishmentDirectory { public static void main (String[] args) { Scanner scnr = new Scanner(System.in); int newRating; String newState; MealEstablishment mealEstablishment1 = new MealEstablishment(); System.out.println("Default values: "); mealEstablishment1.print(); newRating = scnr.nextInt(); newState = scnr.next(); mealEstablishment1.setRating(newRating); mealEstablishment1.setState(newState); System.out.println("After mutator methods: "); mealEstablishment1.print(); } }class WaterSort { Character top = null; // create constants for colors static Character red= new Character('r'); static Character blue = new Character('b'); static Character yellow= new Character('g'); // Bottles declaration public static void showAll( StackAsMyArrayList bottles[]) { for (int i = 0; i<=4; i++) { System.out.println("Bottle "+ i+ ": " + bottles[i]); } } public static void main(String args[]) { //part 1 //create the bottle StackAsMyArrayList bottleONE = new StackAsMyArrayList<Character>(); System.out.println("\nbottleONE:"+ bottleONE+ " size:" + bottleONE.getStackSize()+" uniform? "+ bottleONE.checkStackUniform());…import java.util.Scanner; public class CharMatch { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String userString; char charToFind; int strIndex; userString = scnr.nextLine(); charToFind = scnr.next().charAt(0); strIndex = scnr.nextInt(); /* Your code goes here */ }}
- import java.util.Scanner; public class InstrumentInformation { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Instrument myInstrument = new Instrument(); StringInstrument myStringInstrument = new StringInstrument(); String instrumentName, manufacturerName, stringInstrumentName, stringManufacturer; int yearBuilt, cost, stringYearBuilt, stringCost, numStrings, numFrets; boolean bowed; instrumentName = scnr.nextLine(); manufacturerName = scnr.nextLine(); yearBuilt = scnr.nextInt(); scnr.nextLine(); cost = scnr.nextInt(); scnr.nextLine(); stringInstrumentName = scnr.nextLine(); stringManufacturer = scnr.nextLine(); stringYearBuilt = scnr.nextInt(); stringCost = scnr.nextInt(); numStrings = scnr.nextInt(); numFrets = scnr.nextInt(); bowed = scnr.nextBoolean(); myInstrument.setName(instrumentName); myInstrument.setManufacturer(manufacturerName);…public class Driver { /** * @param args */ static Scanner keyboard = new Scanner(System.in); publicstaticvoid main(String[] args) { Mailbox[] mailboxes = new Mailbox[5]; Mailbox mailbox1 = new Mailbox("gmail"); Mailbox mailbox2 = new Mailbox("outlook"); Mailbox mailbox3 = new Mailbox("icloud"); mailboxes[0] = mailbox1; mailboxes[1] = mailbox2; mailboxes[2] = mailbox3; Email email1 = new Email(); email1.setDate(new Date(2022, 11, 5)); email1.setSubject("Exam2 guidelines "); Email email2 = new Email(new Date(2021, 3, 5), true, "Quiz3 in Ch7"); Email email3 = new Email(); email3.setDate(new Date(2020, 11, 3)); email3.setSubject("Late submission policy"); mailbox2.addEmail(email1); mailbox2.addEmail(email2); mailbox2.addEmail(email3); // System.out.println("Hello! What would you like to do "); intselection = displayMenu(); while (selection != 5) { // selection = displayMenu(); switch (selection) { case 1: System.out.print("Enter the client: "); String…public class Side Plot { * public static String PLOT_CHAR = "*"; public static void main(String[] args) { plotxSquared (-6,6); * plotNegXSquaredPlus20 (-5,5); plotAbsXplus1 (-4,4); plotSinWave (-9,9); public static void plotXSquared (int minX, int maxx) { System.out.println("Sideways Plot"); System.out.println("y = x*x where + minX + "= minX; row--) { for (int col = 0; col row * row; col++) { System.out.print (PLOT_CHAR); if (row== 0){ } System.out.print(" "); } for(int i = 0; i <= maxx* maxX; i++) { System.out.print("-"); } System.out.println(); Sideways PHOT y = x*x where -6<=x<=6 Sideways Plot y = x*x where -6<=x<=6 How do I fix my code to get a plot like 3rd picture?
- public class TestAverage {public static void main(String[] args) {int test1, test2, test3, sum;Scanner reader = new Scanner(System.in);System.out.println("Enter test 1");test1 = reader.nextInt();System.out.println("Enter test 2");test2 = reader.nextInt();System.out.println("Enter test 3");test3 = reader.nextInt();sum = test1 + test2 + test3;System.out.println("The sum is " + sum);System.out.println("The average is " + sum / 3);}}There is one logic error in this code explain what is wrong and how to fix it.import java.util.Scanner; public class StudentScores { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); final int SCORES_SIZE = 4; int[] lowerScores = new int[SCORES_SIZE]; int i; for (i = 0; i < lowerScores.length; ++i) { lowerScores[i] = scnr.nextInt(); } for (i = 0; i < lowerScores.length; ++i) { System.out.print(lowerScores[i] + " "); } System.out.println(); } }1- class Excep { 2- public static void main(String[] args){ 3 try{ int arr[]=(1,2}; 4 int x = arr[1]/arr[0]-1; 6 7 catch(ArithmeticException e) 8- { 9. System.out.printin("divide by e"); 10 } 11 catch(ArrayIndexOutofBoundsException e) 12- { 13 System.out.println("wrong indexing"); 14 15 finally 16- { 17 System.out.println("Runtime error"); 18 } 19 }} 20 Answer: