Menu

Hello Help Great Assistance Wonderful Great Project 0 University Pittsburgh Require Help B Q43816168

Hello. Your help and great assistance are wonderful and great.Below is my Project 0 for the University of Pittsburgh. I requireyour help beginning and completing my assignment. Although you arehelping, tutoring, and assisting me complete this assignment I willstill complete and re-write this assignment and all of my futureassignments myself. Thank you for your tutoring, help, andassistance.

// This code (c) Jeff Cooper
// Written in Spring 2020 for CS 0007

// This is an import statement. It imports something calledjava.util.Scanner,
// which is used to read input from the command line. Despite itsname, it has
// nothing to do with the machine of the same name that scansprinted documents
// into the computer.
import java.util.Scanner;

// This is the public class defined by this file
// Notice that its name (“AssignmentOne”) matches the name of thefile
// (“AssignmentOne.java”)

public class AssignmentOne
{

// This is the main method, which is what runs when we executethis program.
public static void main(String[] args)
{
// This line defines a new scanner. Don’t worry about exactly howit works,
// we’ll cover that in class soon.
Scanner userInputScanner = new Scanner(System.in);

// This outputs “What is your name?” to the screen, followed bya
// newline. This is similar to what we’ve seen in class.
System.out.println(“What is your name?”)

// This defines a variable called “name”, of type String. Stringvariables
// are used to store text. Instead of storing a literal stringvalue in the
// username variable, like we’ve done in lecture examples, thisstatement
// gets a line of text from the user and stores that. In this case,a “line”
// of text is “everything the user types until they pressenter.”
String name = userInputScanner.nextLine();

// This line calls the “scramble” function on the name variable,and stores
// the result in a new variable called “scrambledName”.
String scrambledName = scramble(name);

// Finally, print out the value of scrambled name to thescreen.
System.out.print(“Your scrambled name is: “”);
System.out.print(scrambledName);
System.out.println(“””);
}

// Don’t worry about stuff below this line. It defines a functionthat
// scrambles up your username and returns an encoded version. I’llgo over
// what it’s doing in lecture at some point after this assignmentis due.
// I’ve written this code to be intentionally hard to read.
private static String scramble(String n) {
char[] out = new char[n.length()];
for (int i = 0; i < n.length(); i++) {
char c = n.charAt(n.length() – i – 1);
if (‘A’ <= c && c <= ‘Z’) {
c = (char)((c – ‘A’ + 13) % 26 + ‘A’);
} else if (‘a’ <= c && c <= ‘z’) {
c = (char)((c – ‘a’ + 13) % 26 + ‘a’);
}
out[i] = c;
}

return new String(out);
}
}

Expert Answer


Answer to Hello. Your help and great assistance are wonderful and great. Below is my Project 0 for the University of Pittsburgh. I…

OR