Write a program that asks the user’s name, and then greets the user by name. Before outputting the user’s name, convert it to upper case letters. For example, if the user’s name is Fred, then the program should respond “Hello, FRED, nice to meet you!”.
Input:
Enter any Name: World
Output:
Hello,WORLD,nice to meet you
import java.io.*; import java.util.*; public class temp { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String name,Upname; System.out.println("Enter any name: "); name = scan.nextLine(); Upname = name.toUpperCase(); System.out.println("Hello,"+Upname+",nice to meet you!"); } }
INPUT_1:
Enter any name:
fed
OUTPUT:
Hello,FED,nice to meet you!
INPUT_2:
Enter any name:
fcukthecode
OUTPUT:
Hello,FCUKTHECODE,nice to meet you!
INPUT_3:
Enter any name:
metaverse
OUTPUT:
Hello,METAVERSE,nice to meet you!
INPUT_4:
Enter any name:
playerone
OUTPUT:
Hello,PLAYERONE,nice to meet you!
INPUT_5:
Enter any name:
ass
OUTPUT:
Hello,ASS,nice to meet you!
INPUT_6:
Enter any name:
linuxrockz
OUTPUT:
Hello,LINUXROCKZ,nice to meet you!
ILLUSTRATION
Morae Q!
- Convert from binary number to decimal number.
- Swap two numbers by using division and multiplication.
- Compute foot and inches into centimetres.
- Concatenate Strings.
- Convert lowercase letters to uppercase letters.
- Compute the sum of all the digits of N.
- Compute the area of the pentagon.
- Get input using scanner.
- Find the distance between two points (x1,y1) and (x2,y2).
- Finding patterns in a file using frep and egrep .
- Detecting a cycle in a directed graph using Depth First Traversal.
- Topological ordering in a Graph.
- Storing graphs using adjacency list.
- Introduction to graph theory.
- Graph Adjacency Matrix pseudo code.
- Adjacency Matrix for storing graphs.
- Dijkstra’s shortest path algorithm .
- Breadth first search (BFS) Algorithm.
- Find the multiple of given number in the list of integers.
- Finding patterns in files using grep .