Question

Problem: Alphabet Monster that gets offended Write a program that simulates a monster which acts happy when fed a letter, andimport java.util.Scanner; public class AlphabetMonster { public static void main(String[] args) { Scanner sc = new Scanner(SyI need help modifying this code

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment...

import java.util.Scanner;

public class AlphabetMonster2{

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        System.out.println(":E monster hungry!!!");

        

        while(true){

            System.out.print("feed monster :o ");

            char c = sc.next().charAt(0);

            if(c=='T' || c=='t'){

                System.out.println("Wow...Your so special to me ");

            }

            else if(Character.isLowerCase(c)){

                System.out.println("yum!");

            }

            else if(Character.isUpperCase(c)){

                System.out.println("mmm!");

            }

            else if(Character.isDigit(c)){

                System.out.println("yuck! monseter not calculator");

                break;

            }

            else{

                System.out.println("barffffff! :o=..(.~.(....(");

            }

        }

        System.out.println(">:| BYE rude user");

    }

}

nagarajuõnagaraju-Vostro-3550:22102019$ javac Alphabet Monster2.java nagarajuanagaraju-Vostro-3550:22102019$ java Alphabet Mo

Add a comment
Know the answer?
Add Answer to:
I need help modifying this code Problem: Alphabet Monster that gets offended Write a program that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a program via Java that has atleast 8 characters long, one upper case, and one...

    Create a program via Java that has atleast 8 characters long, one upper case, and one lower case, and one digit. here is my code:     public static void main(String[] args)     {         //variables defined         String passwords;         char password =0;                 //settings up password condition to false         boolean passwordcondition= false;         boolean size=false;         boolean digit=false;         boolean upper=false;         boolean lower=false;         //inputting a scanner into the system         Scanner keyboard = new Scanner(System.in);...

  • hey dear i just need help with update my code i have the hangman program i...

    hey dear i just need help with update my code i have the hangman program i just want to draw the body of hang man when the player lose every attempt program is going to draw the body of hang man until the player lose all his/her all attempts and hangman be hanged and show in the display you can write the program in java language: this is the code bellow: import java.util.Random; import java.util.Scanner; public class Hangmann { //...

  • Java Programming: Hi, I need help Modifying my code that will throw an IllegalArgumentException. for the...

    Java Programming: Hi, I need help Modifying my code that will throw an IllegalArgumentException. for the following data entry error conditions: A number less than 1 or greater than 12 has been entered for the month A negative integer has been entered for the year utilizes a try and catch clause to display an appropriate message when either of these data entry errors exceptions occur. Thank you let me know if you need more info import java.util.*; //Class definition public...

  • I just started working on some code for a password creator. I was doing some testing and I keep g...

    I just started working on some code for a password creator. I was doing some testing and I keep getting this error: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 6 at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47) at java.base/java.lang.String.charAt(String.java:693) at PasswordCreater.check(PasswordCreater.java:56) at Password.main(Password.java:23 In my code I am having the user create a password that is at least 6 characters long, but no more than 16. Also, include at least one lowercase letter, one uppercase letter, one number digit and one special...

  • I need this java program to contain methods that do some of the work that can...

    I need this java program to contain methods that do some of the work that can be modularized. It must logically be the same as this loop program but instead the logic will be modularized into Java Methods. Continue to take input for every employee in a company, and display their information until a sentinel value is entered, that exits the loop and ends the program. import java.util.Scanner; public class SalaryCalc { double Rpay = 0, Opay = 0; void...

  • Hi I need help with a java program that I need to create a Airline Reservation...

    Hi I need help with a java program that I need to create a Airline Reservation System I already finish it but it doesnt work can someone please help me I would be delighted it doesnt show the available seats when running the program and I need it to run until someone says no for booking a seat and if they want to cancel a seat it should ask the user to cancel a seat or continue booking also it...

  • I need eclipse code for : Write a program that analyzes text written in the console...

    I need eclipse code for : Write a program that analyzes text written in the console by counting the number of times each of the 26 letters in the alphabet occurs. Uppercase and lowercase letters should be counted together (for example, both ‘A’ and ‘a’ should count as an A). Any characters that are not letters should be ignored. You must prompt the user to enter the text to be analyzed. Then, for any letter that appeared at least once...

  • Java Programming Language Edit and modify from the given code Perform the exact same logic, except...

    Java Programming Language Edit and modify from the given code Perform the exact same logic, except . . . The numeric ranges and corresponding letter grade will be stored in a file. Need error checking for: Being able to open the text file. The data makes sense: 1 text line of data would be 100 = A. Read in all of the numeric grades and letter grades and stored them into an array or arraylist. Then do the same logic....

  • I need help debugging this Java program. I am getting this error message: Exception in thread...

    I need help debugging this Java program. I am getting this error message: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at population.Population.main(Population.java:85) I am not able to run this program. ------------------------------------------------------------------- import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; /* Linked list node*/ class node { long data; long year; String country; node next; node(String c,long y,long d) { country=c; year=y; data = d; next = null; } } public class Population { private static node head; public static void push(String...

  • need help editing or rewriting java code, I have this program running that creates random numbers...

    need help editing or rewriting java code, I have this program running that creates random numbers and finds min, max, median ect. from a group of numbers,array. I need to use a data class and a constructor to run the code instead of how I have it written right now. this is an example of what i'm being asked for. This is my code: import java.util.Random; import java.util.Scanner; public class RandomArray { // method to find the minimum number in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT