Question

JAVA!!!!!!! The for-loop design contest. In this part of the assignment, we'll have some fun with...

JAVA!!!!!!!

The for-loop design contest. In this part of the assignment, we'll have some fun with for-loops. Write a program called Contest.java with the following features:

You must use exactly four for-loops. That is, the reserved word for needs to appear four times.

At least one for-loop needs to be nested.

You must use at least four but not more than eight System.out.print's or System.out.println's. A total of eight combined.

Each System.out.print or System.out.println is allowed to print at most one letter.

The goal is to be creative in your program. We will give points for creativity and complexity. Both the code structure and the output will be evaluated. Important: you need to understand your code and be prepared to explain it class. The best way to do this is to be sure you've traced through an execution of your prorgram step by step (on paper).

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

public class Driver{

public static void main(String args[])

{

// All the below conditions are satisfied

// Used exactly four for-loops

// Reserved word for appears four times

// At least one for-loop needs to be nested

// Used four System.out.print's or System.out.println's

// Each System.out.print or System.out.println is allowed to print at most one letter.

for(int i = 0; i < 4; i++){

System.out.print("f");

for(int j = 0; j < 1; j++){

System.out.print("o");

for(int k = 0; k < 1; k++){

System.out.print("r");

for(int l = 0; l < 1; l++){

System.out.println();

}

}

}

}

}

}

<terminated> Driver (3) for for for for

**Comment for any further queries.

Add a comment
Know the answer?
Add Answer to:
JAVA!!!!!!! The for-loop design contest. In this part of the assignment, we'll have some fun with...
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
  • his assignment will help the student by: Create shapes using Java code Using and creating colors...

    his assignment will help the student by: Create shapes using Java code Using and creating colors with Java Coding JFrames and using the Graphics g method Using Loops (to draw) Your program will generate a drawing using java. You should draw an object that makes sense, not just spare shapes and colors. You must use at least 3 different shapes You must use at least 2 different fonts You must use at least 2 predefined java colors and one custom-made...

  • This Python program will need to include the following items listed below. You are to customize...

    This Python program will need to include the following items listed below. You are to customize your program and create the sequence in any order of your choice. Write in simple code. Must include Python comments for each of the items show below. Calculate a Percentage. For example, the discount percentage on a sale item. Use of 3 Constants. To be used for values that will not change throughout the life of the program. A Turtle Graphic Logo. This logo...

  • write a java program that does the following Part one Use a For loop to compute...

    write a java program that does the following Part one Use a For loop to compute the sum of all the odd numbers from 1 through 99. Your result should be labeled, and the value should be 2500. Print your name 7 times using a While loop. String dogNames[ ] = {"Sam","Buster","Fido","Patches","Gromit","Flicka"}; Using the array defined here, print the values of the array vertically and horizontally using one For-Each loop. Reverse the logic (Nested loops: Indent text) so that the...

  • Lab 5 Instructions For Lab 5, you will be writing a more complex modular program that...

    Lab 5 Instructions For Lab 5, you will be writing a more complex modular program that uses at least two arrays, and has at least one loop that accesses the data in the arrays. As long as your program satisfies the requirements listed below, you are free to design and write any type of program that you care to. You are encouraged to be creative, and pick something that has meaning for you, because you'll have more fun. Feel free...

  • My Java code from last assignment: Previous Java code: public static void main(String args[]) { //...

    My Java code from last assignment: Previous Java code: public static void main(String args[]) { // While loop set-up boolean flag = true; while (flag) { Scanner sc = new Scanner(System.in); // Ask user to enter employee number System.out.print("Enter employee number: "); int employee_number = sc.nextInt(); // Ask user to enter last name System.out.print("Enter employee last name: "); String last_name = sc.next(); // Ask user to enter number of hours worked System.out.print("Enter number of hours worked: "); int hours_worked =...

  • My Java code from last assignment: Previous Java code: public static void main(String args[]) { //...

    My Java code from last assignment: Previous Java code: public static void main(String args[]) { // While loop set-up boolean flag = true; while (flag) { Scanner sc = new Scanner(System.in); // Ask user to enter employee number System.out.print("Enter employee number: "); int employee_number = sc.nextInt(); // Ask user to enter last name System.out.print("Enter employee last name: "); String last_name = sc.next(); // Ask user to enter number of hours worked System.out.print("Enter number of hours worked: "); int hours_worked =...

  • -----------Python program------------------- Instructions: For this assignment, you will write complete a program that allows a customer...

    -----------Python program------------------- Instructions: For this assignment, you will write complete a program that allows a customer to plan for retirement. Part 2: Generate a Retirement Planning Table: It's hard to decide how much you need to save for retirement. To help your customer visualize how long her nest egg will last, write a program that allows the user to generate a retirement planning table showing the number of months the savings will last for various combinations of starting account balance...

  • You have to write a java solution for a store. Part 1 The solution needs to...

    You have to write a java solution for a store. Part 1 The solution needs to have at least following features: ◦ Item: Name, ID (incremental ID by 1 for each product), Price. ◦ Store Basket: ID (incremental ID by 1 for each basket), Net Amount, Total Amount, VAT, List of items, Date and Time of purchase, Address of the store, name of cashier. ◦ Cashier: Name, Surname, Username and Password (insert from code five fixed cashiers). ◦ Manager: Name,...

  • Sorting Threads Assignment Overview Write a multithreaded sorting program in Java which uses the ...

    Sorting Threads Assignment Overview Write a multithreaded sorting program in Java which uses the merge sort algorithm. The basic steps of merge sort are: 1) divide a collection of items into two lists of equal size, 2) use merge sort to separately sort each of the two lists, and 3) combine the two sorted lists into one sorted list. Of course, if the collection of items is just asingle item then merge sort doesn’t need to perform the three steps,...

  • Step 1: Getting Started Create a new .java file named Lab12.java. At the beginning of this...

    Step 1: Getting Started Create a new .java file named Lab12.java. At the beginning of this file, include your assignment documentation code block. After the documentation block, you will need several import statements. import java.util.Scanner; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; Next, declare the Lab12 class and define the main function. public class Lab12 { public static void main (String [] args) { Step 2: Declaring Variables For this section of the lab, you will need to declare...

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