Question

drawing the national flag of France in Java Programming

Write a Java program to draw the national flag of France. (there is a strip of blue, a stripe of white, and a stripe of red. Each stripe should be 30width x 60height)
0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.io.*;
import java.applet.*;
import java.awt.*;
public class flag extends Applet
{
public void paint(Graphics g)
{
g.fillOval(60,450,120,50);
g.fillRect(110,60,10,400);
g.setColor(Color.red);
g.fillRect(120,80,150,30);
g.setColor(Color.white);
g.fillRect(120,110,150,30);
g.setColor(Color.green);
g.fillRect(120,140,150,30);
g.setColor(Color.black);
g.drawRect(120,80,150,90);
g.setColor(Color.blue);

g.drawOval(180,110,30,30);
int t=0;
int x=195,y=125;
double x1,y1;
double r=15;
double d;
for(int i=1;i<=24;i++)
{
d=(double)t*3.14/180.0;
x1=x+(double)r*Math.cos(d);
y1=y+(double)r*Math.sin(d);
g.drawLine(x,y,(int)x1,(int)y1);
t+=360/24;
}
}
}
answered by: Corleone
Add a comment
Know the answer?
Add Answer to:
drawing the national flag of France in Java Programming
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
  • Combinatorics problem, show all work. a. A flag is to be designed with 10 stripes. The...

    Combinatorics problem, show all work. a. A flag is to be designed with 10 stripes. The strips can be red, yellow, or blue. No stripe should be the same color as the one below it. How many ways are there to color the flag? b. How many sets of 3 different numbers each can be formed from the numbers {1, 2, 3, ..., 19, 20} if no 2 consecutive numbers are to be in a set?

  • Help, I would also want to know how to draw the stars as well please. JavaFX (50 Pts) r ins Use JavaFX Application to draw the American Flag (without the stars). It has thirteen alternatin,g red and...

    Help, I would also want to know how to draw the stars as well please. JavaFX (50 Pts) r ins Use JavaFX Application to draw the American Flag (without the stars). It has thirteen alternatin,g red and white horizontal stripes (use a for loop). In the upper left, it has a bluerectangle with 50 white stars(You can use Polygon to draw stars = 20 extra pts). The official definition of the colors for the US flag are RED = new...

  • Please show work. Thanks Practice Problem 3 Americana Inc, sells three different flag types they label...

    Please show work. Thanks Practice Problem 3 Americana Inc, sells three different flag types they label red, white and blue. Their unit sales prices are red, $20; white, $35; and blue, $65. The per unit variable costs to manufacture and sell these products are red, $12, white, $22; and blue, $50. Their sales mix is reflected in a ratio of 5:4:2 (red:white:blue). Annual fixed costs shared by all three products are $250.000. One type of raw material has been used...

  • National Co. manufactures and sells three products: red, white, and blue. Their unit sales prices are...

    National Co. manufactures and sells three products: red, white, and blue. Their unit sales prices are red, $47, white, $77, and blue, $102. The per unit variable costs to manufacture and sell these products are red, $32, white, $52, and blue, $72. Their sales mix is reflected in a ratio of 5:4:2 (red:white:blue). Annual fixed costs shared by all three products are $142,000. One type of raw material has been used to manufacture all three products. The company has developed...

  • National Co. manufactures and sells three products: red, white, and blue. Their unit sales prices are...

    National Co. manufactures and sells three products: red, white, and blue. Their unit sales prices are red, $47, white, $77, and blue, $102. The per unit variable costs to manufacture and sell these products are red, $32, white, $52, and blue, $72. Their sales mix is reflected in a ratio of 5:4:2 (red:white:blue). Annual fixed costs shared by all three products are $142,000. One type of raw material has been used to manufacture all three products. The company has developed...

  • All the programs are to be written in java 1. WAP to print American Flag Using...

    All the programs are to be written in java 1. WAP to print American Flag Using Loop in as minimum code as possible. 1.1 Ask user to enter age, sex ( M or F ), marital status ( Y or N ) and then using following rules print their place of service.    if employee is female, then she will work only in urban areas.    if employee is a male and age is in between 20 to 40 then...

  • In a certain plant, flowers can be either white, red or blue. The following crosses were...

    In a certain plant, flowers can be either white, red or blue. The following crosses were performed with different flower colour varieties: Cross 1: P: red x red F1: all red F2: all red Cross 2: P: blue x red F1: 148 blue, 149 red, 103 white Cross 3: P: blue x white F1: all blue F2: 221 blue, 79 red, 100 white Based on the crosses, how many genes control flower colour? Include a chi-square test to support your...

  • Directions: Complete all the three programming assignments below. Please be sure to follow the programming rubric...

    Directions: Complete all the three programming assignments below. Please be sure to follow the programming rubric provided. Turn in three separate “.py" files. Be sure to run your programs before submission. Color Mixer The colors red, blue, and yellow are called primary colors, because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here: • When you mix red and blue, you get purple. • When you mix...

  • It needs to be done in JAVA Please don't use the flag=true method. I need it...

    It needs to be done in JAVA Please don't use the flag=true method. I need it done in another way. The user should input the number of numbers they are going to enter. Your job is to find the maximum and the minimum of these numbers. The output of the program if the user does not enter a negative number and all iterations successfully terminate, will be the maximum number, the minimum number and their difference(max-min). If the user inputs...

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