Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

for each of these problems, I need a quick algorithm/pseudocode/flowchart in JAV

ID: 3869345 • Letter: F

Question

for each of these problems, I need a quick algorithm/pseudocode/flowchart in JAVA!! i dont need the whole program just the algorithm/pseudodoe/flowchart. please make it simple so i can undestand it! I'm new to java

Problem 1: Write a program that prompts the user for a measurement in meters, and then converts it in to miles, feet, and inches.

Problem 2: Write a program that reads in an integer, and breaks it into a sequence of individual digits. Display each digit on a separate line. For example, the input 16384 is displayed as 1 6 3 8 4 You may assume that the input has no more than five digits and is not negative.

Problem 3: Write a program that asks the user to input: The number of gallons of gas in the tank The fuel efficiency in miles per gallon The price of gas per gallon Then print the cost per 100 miles and how far the car can go with the gas in the car.

Problem 4: 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

Problem 5: Read a word from the user and display the string with the letters shifted to the right by two positions and with the letters shifted to the left by two positions in the string. Save all of the three strings in separate variables and display all three of them at the end of the program.

Explanation / Answer

Problem1.java

import java.util.Scanner;

public class Problem1 {

public static void main(String[] args) {

//Problem 1: Write a program that prompts the user for a measurement in meters,

//and then converts it in to miles, feet, and inches.

Scanner scan = new Scanner(System.in);

System.out.println("Enter the measurement in Meters: ");

double meter = Double.valueOf(scan.nextLine());

double miles = meter * 0.0000621;

double feet = meter * 3.28084;

double inches = meter * 39.37;

System.out.println(meter+" Meter : "+miles+" Miles Or "+feet + " Feet Or "+inches+" Inches");

}

}

Sample output:

Enter the measurement in Meters:
1
1.0 Meter : 6.21E-5 Miles Or 3.28084 Feet Or 39.37 Inches

Problem2.java

import java.util.Scanner;

public class Problem2 {

public static void main(String[] args) {

//Problem 2: Write a program that reads in an integer, and breaks it into a sequence of individual digits.

//Display each digit on a separate line.

//For example, the input 16384 is displayed as 1 6 3 8 4

//You may assume that the input has no more than five digits and is not negative.

Scanner scan = new Scanner(System.in);

System.out.println("Enter an Integer: ");

String intStr = scan.nextLine();

for(int i=0; i<intStr.length();i++){

System.out.println(intStr.charAt(i));

}

}

}

sample output:

Enter an Integer:
463428236
4
6
3
4
2
8
2
3
6

Problem3.java

import java.util.Scanner;

public class Problem3 {

public static void main(String[] args) {

//Problem 3: Write a program that asks the user to input: The number of gallons of gas in the tank

//The fuel efficiency in miles per gallon

//The price of gas per gallon

//Then print the cost per 100 miles and how far the car can go with the gas in the car.

Scanner scan = new Scanner(System.in);

System.out.println("The number of gallons of gas in the tank : ");

int gallons = Integer.valueOf(scan.nextLine());

System.out.println("The fuel efficiency in miles per gallon :");

double milesPerGallon = Double.valueOf(scan.nextLine());

System.out.println("The price of gas per gallon : ");

double price = Double.valueOf(scan.nextLine());

double gasInGallonPerMile = 1/milesPerGallon;

double priceFor100Miles = gasInGallonPerMile * price * 100;

System.out.println("Cost per 100 miles : "+priceFor100Miles);

double milescanBeTravelled = gallons * milesPerGallon;

System.out.println("How far the car can go with the gas in the car : "+milescanBeTravelled);

}

}

Sample Output:

The number of gallons of gas in the tank :
100
The fuel efficiency in miles per gallon :
3.5
The price of gas per gallon :
700
Cost per 100 miles : 20000.0
How far the car can go with the gas in the car : 350.0

Problem4.java

import java.util.Scanner;

public class Problem4 {

public static void main(String[] args) {

//Problem 4: 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

Scanner scan = new Scanner(System.in);

System.out.println("Enter the name of your favourite city: ");

String favCity = scan.nextLine();

System.out.println("The number of characters in the city name : "+favCity.length());

System.out.println("To Uppercase : "+favCity.toUpperCase());

System.out.println("To Lowercase : "+favCity.toLowerCase());

System.out.println("First character in the name of the city : "+favCity.charAt(0));

}

}

Sample Output:

Enter the name of your favourite city:
Illinois
The number of characters in the city name : 8
To Uppercase : ILLINOIS
To Lowercase : illinois
First character in the name of the city : I

Problem5.java

import java.util.Scanner;

public class Problem5 {

public static void main(String[] args) {

//Problem 5: Read a word from the user and display the string with the letters shifted to the right by two positions

//and with the letters shifted to the left by two positions in the string.

//Save all of the three strings in separate variables and display all three of them at the end of the program.

Scanner scan = new Scanner(System.in);

System.out.println("Enter any String: ");

String str = scan.nextLine();

String shiftedRt = str.substring(0,str.length()-2);

shiftedRt = str.charAt(str.length()-1) + shiftedRt;

shiftedRt = str.charAt(str.length()-2) + shiftedRt;

String shiftedLt = str.substring(2,str.length());

shiftedLt = shiftedLt + str.charAt(0) ;

shiftedLt = shiftedLt + str.charAt(1) ;

System.out.println("String : "+str);

System.out.println("Shifted 2 positions to Right : "+shiftedRt);

System.out.println("Shifted 2 positions to Left : "+shiftedLt);

}

}

Sample output:

Enter any String:
VERTICAL
String : VERTICAL
Shifted 2 positions to Right : ALVERTIC
Shifted 2 positions to Left : RTICALVE