Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary university

Rating
-
Sold
-
Pages
1
Uploaded on
02-09-2025
Written in
2023/2024

“This collection of documents covers essential courses in Computer Science and Mathematics for first-year university students. It includes lecture notes, detailed summaries, solved exercises, and past exam questions. The materials explain topics clearly, from algorithms, programming, and data structures to calculus, linear algebra, and statistics. Designed to help students save time, understand key concepts, and prepare effectively for exams, these resources are perfect for Blida University students and anyone studying in similar programs.”

Show more Read less
Institution
Course

Content preview

Abdelhamid Mehri Constantine 2 University

NTIC Faculty L1/S2 2023–2024

Introduction to Object-Oriented Programming

Lab 2

Exercise 1
Write a program that takes a positive real number r and displays the largest even number strictly less
than r.
Hints:
- Use a Scanner object scr for input created by Scanner scr=new Scanner(System.in);
- Import the Scanner class by adding import java.util.Scanner; at the beginning of the file.
- scr.nextDouble(); retrieves a real number entered via the keyboard.

Exercise 2
1. Write the Point class :
Point
double x
double y
Point symY()//gives the point symmetric to the y-axis
Point symX()//gives the point symmetric to the x-axis
double distance(Point)// gives the distance to another point
2. Write the Circle class :
Circle
Point centre
double radius
double surface()//gives the surface area of the circle
boolean includes(Point)// checks if a point belongs to the circle
double distance(Point)// gives the distance to another point
3. Write the Rectangle class :
Rectangle
Point corner1
Point corner2// sides are parallel to the x and y axes.
double surface()//gives the surface area of the rectangle
double perimeter ()//gives the perimeter of the rectangle
4. Write a program to:
a. Enter the coordinates of 3 points a, b, and c.
b. Display the coordinates of the symmetric points to each of the three points with respect to the
x and y axes.
c. Calculate the distances between the three points to determine the type of triangle.
d. Enter the radii of three circles with centres a, b, and c.
e. Display the areas of the three circles.
f. Check if a point d entered by the user belongs to any of the circles.
g. Display the surface area and perimeter of the rectangle with a and b as two opposite corners.

Written for

Course

Document information

Uploaded on
September 2, 2025
Number of pages
1
Written in
2023/2024
Type
SUMMARY

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
chaimabenyouci

Get to know the seller

Seller avatar
chaimabenyouci informatique
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
8 months
Number of followers
0
Documents
15
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions