Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me with the following Java programming project questions, I hope to get a correct answer as a reference, thank you very much. I

Please help me with the following Java programming project questions, I hope to get a correct answer as a reference, thank you very much.
I need to finish two tasks in this exercise:
Read a line of text from the user (after finishing one line the program will read another line until the user enters 'bye' as the input)
Convert the 'emoji letters' to emojis
If c equals to 'h' or 'H', change it to a happy emoji: :-)
If c equals to 'a' or 'A', change it to an angry emoji: *^*
If c equals to 's' or 'S', change it to a sad emoji: :-(
Here is part of the code.
Please complete this code on the basis of the following incomplete code, and try not to modify the framework that has already been set:
import java.util.Scanner;
public class AsciiToEmoji
{
/**
* The starting point of the program.
*/
public static void main(String[] args)
{
// Task 1.1: Prepare a scanner for user input handling
// The input line
String line ="";
// A temporary character as buffer
char ch ='';
// Keep asking for the input until it is equal to "bye"
do {
System.out.print("Please enter a line of text (enter 'bye' to quit the program): ");
// Task 1.2: Read a line from the scanner object
// Task 2: Convert the emoji letters to emojis
} while (false);
}
}
Here is an example output of the finished progam.
Please enter a line of text (enter 'bye' to quit the program): What?
W:-)*^*t?
Please enter a line of text (enter 'bye' to quit the program): Someone changed my text!
:-(omeone c:-)*^*nged my text!
Please enter a line of text (enter 'bye' to quit the program): Oh!
!
Please enter a line of text (enter 'bye' to quit the program): bye
bye
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions

Question

develop your skills of project planning.

Answered: 1 week ago

Question

evaluate different research strategies;

Answered: 1 week ago