only need help on Netherland flag and Swiss flag of question#3 by using Java. Th
ID: 3734867 • Letter: O
Question
only need help on Netherland flag and Swiss flag of question#3 by using Java. Thank you very much.
Objectives: .Use of Classes User of Methods .Use of Graphics Scenarios: 1. Write atie class that contains the following fields: hours, minutes and seconds. The class should also have the following methods: a. Set: to set the time b. Write: to write the time c. Equal: to compare the time in term of equality (returning true or false) d. Less than: to compare the time in term of precedence (returning true or false) e. Provide few cases where a class is initialized, using a constructor f. Provide few cases where these methods are called. Write a simple class representing a bank account: the bank account has 2 fields: balance, interest rate 2. a. b. c. d. e. Provide a constructor for this class Write a method that set a bank account Write a method that get the balance Write a method that get the rate Write a method that update the balance Drawing graphical shapes: a sample code for drawing the French flag has been provided. Modify this code to: 3. 1. 2. 3. Draw the flag from Belgium Draw the flag from Netherland Draw the flag from Swiss Individual frames can be used for each of these flags Example for French flagExplanation / Answer
import java.awt.*;
import java.awt.image.*;
import java.awt.Color;
import acm.graphics.*;
import acm.program.*;
public class DrawFlags extends GraphicsProgram {
public void run() {
GRect r = new GRect(0, 0, 50, 50);
drawNetherlandsFlag();
}
// Netherlands
private void drawNetherlandsFlag() {
drawHorizontalStripe(Color.RED, 0);
drawHorizontalStripe(Color.WHITE, 0.33);
drawHorizontalStripe(Color.BLUE, 0.66);
//swiss flag
BufferedImage
i=new BufferedImage(32,32,1);
Graphics g=i.getGraphics();
g.setColor(Color.RED);
g.fillRect(0,0,32,32);g.setColor(Color.WHITE);
g.fillRect(13,6,6,20);
g.fillRect(6,13,20,6);javax.imageio.ImageIO.write(i,"png",new java.io.File("a"));
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.