Question

In: Computer Science

You will write a single class named WordsXX- replace the XX's with your initials. The program...

You will write a single class named WordsXX- replace the XX's with your initials.

The program will have 2 overloaded methods named wordMaker. They will have to be declared as static. Both methods will not have a return type but they will print some text.

The first method wordMaker signature will not accept any parameters and when invoked will simply print out the line "lower case words".

The second overloaded wordMaker method will accept an integer and print "Words in UPPER CASE" . The method will print the phrase as many times as the parameter indicates with each new iteration printed on a new line.


Write a main method that prompts users to enter either the word "lower" or "upper". (Make sure you allow for all varieties of capitalization.)

If they enter "upper" then generate a random number from 3-9 and call wordMaker to print the upper case phrase that many times.

If they enter "lower" it will use the other version of the method.

can you guys do it right now please this is so urgent please do it Java

Solutions

Expert Solution

import java.util.Random;
import java.util.Scanner;
public class Main
{
    public static void wordMaker()
    {
        System.out.println("lower case words");
    }
    
    public static void wordMaker(int n)
    {
        for(int i = 0;i<n;i++)
            System.out.println("words in UPPER CASE");
    }  
    
    public static void main(String[] args) 
        {
            Scanner sc= new Scanner(System.in);
            System.out.print("Enter 'upper' or 'lower' : ");  
        String str= sc.nextLine();
        str = str.toLowerCase();
        Random random = new Random();
                if(str.equals("upper"))
                    wordMaker(random.nextInt(6)+3);
                else if(str.equals("lower"))
                    wordMaker();
                else
                    System.out.print("Invalid input");  
        }
}

Let me know if you need any changes, I'll try to get it done ASAP


Related Solutions

You will write a single class named WordsXX- replace the XX's with your initials. The program...
You will write a single class named WordsXX- replace the XX's with your initials. The program will have 2 overloaded methods named wordMaker. They will have to be declared as static. Both methods will not have a return type but they will print some text. The first method wordMaker signature will not accept any parameters and when invoked will simply print out the line "lower case words". The second overloaded wordMaker method will accept an integer and print "Words in...
Write a java program that has a class named Octagon that extends the class Circ and...
Write a java program that has a class named Octagon that extends the class Circ and implements Comparable (compare the object's area) and Cloneable interfaces. Assume that all the 8 sides of the octagon are of equal size. Your class Octagon, therefore, must represent an octagon inscribed into a circle of a given radius (inherited from Circle) and not introduce any new class variables. Provide constructors for clas Octagon with no parameters and with 1 parameter radius. Create a method...
Write a C++ program (The Account Class) Design a class named Account that contains (keep the...
Write a C++ program (The Account Class) Design a class named Account that contains (keep the data fields private): a) An int data field named id for the account. b) A double data field named balance for the account. c) A double data field named annualInterestRate that stores the current interest rate. d) A no-arg constructor that creates a default account with id 0, balance 0, and annualInterestRate 0. e) The accessor and mutator functions for id, balance, and annualInterestRate....
PYTHON Suppose you need to import a single class named GeneTools from a module named bioinformatics,...
PYTHON Suppose you need to import a single class named GeneTools from a module named bioinformatics, in Python. Which of the following represents the correct use of an import statement? import GeneTools from bioinformatics from bioinformatics import GeneTools from bioinformatics import * import GeneTools
Assignment Write a program using turtle graphics which writes your initials, or any other three unique...
Assignment Write a program using turtle graphics which writes your initials, or any other three unique letters, to the display. Look to your program for lab 1 for reminders of how to use turtle graphics. Functions that must be written: def drawLetter (x, y, letterColor): Write three functions, one for three unique letters. Personally, I would write drawA, drawR, and drawS. Each function must draw that letter to the screen. The x and y values determine the upper left-hand location...
Write a Java program (single file/class) whose filename must be Numbers.java. The program reads a list...
Write a Java program (single file/class) whose filename must be Numbers.java. The program reads a list of integers from use input and has the following methods: 1. min - Finds the smallest integer in the list. 2. max- Finds the largest integer in the list. 3. average - Computes the average of all the numbers. 4. main - method prompts the user for the inputs and ends when the user enter Q or q and then neatly outputs the entire...
Write a program to remove extra blanks from text files. Your program should replace any string...
Write a program to remove extra blanks from text files. Your program should replace any string of two or more blanks with one single blank. It should work as follows: * Create a temporary file. * Copy from the input file to the temporary file, but do not copy extra blanks. * Copy the contents of the temporary file back into the original file. * Remove the temporary file. Your temporary file must have a different name than any existing...
Java program Create a public method named saveData for a class named Signal that will hold...
Java program Create a public method named saveData for a class named Signal that will hold digitized acceleration data. Signal has the following field declarations private     double timeStep;               // time between each data point     int numberOfPoints;          // number of data samples in array     double [] acceleration = new double [1000];          // acceleration data     double [] velocity = new double [1000];        // calculated velocity data     double [] displacement = new double [1000];        // calculated disp...
Write a java program using the information given Design a class named Pet, which should have...
Write a java program using the information given Design a class named Pet, which should have the following fields (i.e. instance variables):  name - The name field holds the name of a pet (a String type)  type - The type field holds the type of animal that a pet is (a String type). Example values are “Dog”, “Cat”, and “Bird”.  age - The age field holds the pet’s age (an int type) Include accessor methods (i.e. get...
You are to write a class named Rectangle. You must use separate files for the header...
You are to write a class named Rectangle. You must use separate files for the header (Rectangle.h) and implementation (Rectangle.cpp) just like you did for the Distance class lab and Deck/Card program. You have been provided the declaration for a class named Point. Assume this class has been implemented. You are just using this class, NOT implementing it. We have also provided a main function that will use the Point and Rectangle classes along with the output of this main...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT