0% found this document useful (0 votes)
33 views2 pages

Week 9 Computer Graphics CPCS 391 Session 2015/2016, Semester 1 Wednesday, 10 - 11.40 Thursday, 8.00-9.40

This document provides information about a computer graphics course at Northern Border University in Saudi Arabia. The course is titled "Computer Graphics" and is offered during the 2015/2016 semester. It includes 3 tasks related to drawing circles using a programming language: 1) Write a program to draw a single circle, 2) Write a program to draw multiple circles with varying properties, and 3) Write a program to draw 20 circles with incrementally increasing radii. It also provides a sample program that draws a single red circle.

Uploaded by

shahzuind
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views2 pages

Week 9 Computer Graphics CPCS 391 Session 2015/2016, Semester 1 Wednesday, 10 - 11.40 Thursday, 8.00-9.40

This document provides information about a computer graphics course at Northern Border University in Saudi Arabia. The course is titled "Computer Graphics" and is offered during the 2015/2016 semester. It includes 3 tasks related to drawing circles using a programming language: 1) Write a program to draw a single circle, 2) Write a program to draw multiple circles with varying properties, and 3) Write a program to draw 20 circles with incrementally increasing radii. It also provides a sample program that draws a single red circle.

Uploaded by

shahzuind
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Kingdom of Saudi Arabia

Ministry of High Education


Northern Border University
Faculty of Computing and Information
Technology
Department of Computer Science

Week 9
Computer Graphics
CPCS 391
Session 2015/2016, Semester 1
Wednesday, 10 11.40
Thursday, 8.00-9.40
Teacher Name: Dr. Irshad Ahmad
Lab Teacher: Mrs. Nazia Kausar
Lab Teacher: Mr. Mehtab Mehdi

Task 1:
Write a simple program to draw a circle.

Task 2:
Write a single program to draw many circles with difference in
o

Line width
o
o

Radius
Color
Task 3:

Write a single program to draw 20 circles with increasing radii.

Write a simple program to draw a circle.


import java.lang.*;
import java.util.*;
import java.util.List;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;

public class DrawCircle extends Frame {


public void paint(Graphics g) {
Graphics2D ga = (Graphics2D)g;
ga.setPaint(Color.red);
ga.drawOval(150,150,100,100);
}
public static void main(String args[])
{
DrawCircle frame = new DrawCircle();
frame.addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
}
);
frame.setSize(400, 400);
frame.setVisible(true);
}
}

You might also like