Question

In: Computer Science

Create an applet that will draw a set of ovals. The user can specify the number...

Create an applet that will draw a set of ovals. The user can specify the number of ovals. submit java code

Solutions

Expert Solution

Below is the required code:-

  1. import java.applet.Applet;
  2. import java.awt.Color;
  3. import java.awt.Graphics;
  4. public class ovalshaper extends Applet{
  5. public void paint(Graphics gr){      
  6. setForeground(Color.blue);   
  7. gr.drawOval(20,20,30,50);         
  8. gr.fillOval(70,20,30,50);   
  9. }
  10. }

Thank you.


Related Solutions

Write a JAVA program that asks a user to specify the number of months, investment amount...
Write a JAVA program that asks a user to specify the number of months, investment amount and compound interest rate in % (per annum) • Your program should then print each month, starting balance, interest earned and ending balance • Your program is not expected to handle more than 5 months • The balance and ending balance should be printed rounded to 2 decimal places • You should utilise String.format() to display each line of the output. This function can...
Draw Lewis structures for each of the following compounds. In each case, specify the number of...
Draw Lewis structures for each of the following compounds. In each case, specify the number of valence electrons surrounding the central atom. a) bromine dioxide (BrO2) (Assume the central atom does not contain an expanded octet.) There are ___ valence electrons surrounding the central atom. b) beryllium fluoride (BeF2) There are___ valence electrons surrounding the central atom. c) phosphorus pentabromide (PBr5) There are ___ valence electrons surrounding the central atom.
Create an application that makes the user guess a number. The user must be allowed tries....
Create an application that makes the user guess a number. The user must be allowed tries. You must have a loop, user input (Scanner), and a constructor. (JAVA)
In html create a Watchlist page in which a user can create as many watchlist as...
In html create a Watchlist page in which a user can create as many watchlist as they wish. This page will contain the list of watchlist, allow the user to create a new watchlist, and delete an existing one. You have to implement the following: a) A list of all the watchlist that a user has created. For now, you can randomly create few. b) An option to create a new watchlist. Make sure you ask the user what the...
Show: Create an application that allows the user to enter the number of calories and fat...
Show: Create an application that allows the user to enter the number of calories and fat grams in a food. The application should display the percentage of the calories that come from fat. If the calories from fat are less than 30% of the total calories of the food, it should also display a message indicating the food is low in fat. One gram of fat has 9 calories, so: Calories from fat = fat grams *9 The percentage of...
Create a C++ program that will prompt the user to input an integer number and output...
Create a C++ program that will prompt the user to input an integer number and output the corresponding number to its numerical words. (From 0-1000000 only) **Please only use #include <iostream>, switch and if-else statements only and do not use string storing for the conversion in words. Thank you.** **Our class is still discussing on the basics of programming. Please focus only on the basics. Thank you.** Example outputs: Enter a number: 68954 Sixty Eight Thousand Nine Hundred Fifty Four...
Java Programming Create a program that prompts the user for an integer number and searches for...
Java Programming Create a program that prompts the user for an integer number and searches for it within an array of 10 elements. What is the average number of comparisons required to find an element in the array? Your program should print the number of comparisons required to find the number or determine that the number does not exist. Try finding the first and last numbers stored in the array. Run your program several times before computing the average.
Create design document for a program that will allow the user: Convert a number to binary....
Create design document for a program that will allow the user: Convert a number to binary. Convert from binary to number. Display the hexadecimal representation of a binary number. Given an hexadecimal display its binary representation. Convert a number to IEEE single precision and vice versa. More to come. PLEASE ADD PSEUDOCODE AND USE C PROGRAMMING USE FUNCTIONS IF POSSIBLE
. Create a Python function that asks the user for a number (integer). The function should...
. Create a Python function that asks the user for a number (integer). The function should then tell the user how many hundreds can go into the number, and how much is left over. Hint: the % operator calculates the remainder of a division. For example, 10 % 3 gives a result 1. Hint2: Deal with the positive and negative values in separate parts of an if-else structure. Get the calculation work for positive values first. For negative values, make...
Create a C++ program that will prompt the user to input an integer number and output...
Create a C++ program that will prompt the user to input an integer number and output the corresponding number to its numerical words. (From 0-1000000 only) **Please only use #include <iostream> and switch and if-else statements only. Thank you. Ex. Enter a number: 68954 Sixty Eight Thousand Nine Hundred Fifty Four Enter a number: 100000 One Hundred Thousand Enter a number: -2 Number should be from 0-1000000 only
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT