0% found this document useful (0 votes)
6 views4 pages

Advanced Java Programming Exam Guide

The document outlines an advanced programming exam for Java, including theoretical questions about classes and interfaces, practical exercises involving geometric progressions, and the development of a checkout application for a supermarket. It also includes tasks related to error identification in Java code and modeling a recruitment management system using UML diagrams. The exam covers various aspects of Java programming, object-oriented design, and application modeling.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Advanced Java Programming Exam Guide

The document outlines an advanced programming exam for Java, including theoretical questions about classes and interfaces, practical exercises involving geometric progressions, and the development of a checkout application for a supermarket. It also includes tasks related to error identification in Java code and modeling a recruitment management system using UML diagrams. The exam covers various aspects of Java programming, object-oriented design, and application modeling.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

M1 MIAGE 2IS Année universitaire 2017-2018

Session 1 - Semestre 1

[Link]/[Link]

Advanced Programming- Java


Duration: 3h
___________________________________________________________________
Documents are not allowed
____________________________________________________________

1. Course questions
1.1. Explain the difference between « class », « abstract class » and « interface ».
1.2. Explain why the method « public String toString() » can be called on any object.
1.3. Give 2 ways of using the « this » keyword.

2. Exercice
Write a method that prints in the console all the values lower than 100 of the following
geometric progression (un)1 defined by:
- un = un-1 * r
- u0 = 5
- r=3

3. Modeling and implementation.


We want to develop a checkout application for a supermarket. The program must be
able, for a customer, to register the different products bought by the customer: the set of
products represents a cart. Based on the cart, the application should produce a string of
characters that may be printed on a receipt.
The store contains many products. These products include simple products that only
have a name and a price (e.g. a milk bottle). We also find fresh products with a price
based on the weight (for example fruits and vegetables); these products have a name, a
weight and a price per kilo. We will also find bundle products which are a set of similar
products (for example, a bundle of 6 bottles of milk).

1
The definition of the regression means that:
- u1 = r*u0
- u2 = r*u1 = r2*u0
- u3 = r*u2 = r3*u0
- …

Page 1 sur 4
3.1. Write and justify a class diagram of the different classes of the application.
3.2. Write the java code of the main method which represents a customer with a cart
containing the following products: 1 packet of snacks (1 € 30), 2 cans of condensed
milk (2 € 34), 1 bundle of 12 milk bottles (0 € 70 per brick of milk), 1.5kg of orange (2
€ 30 per kilo). The main method should also call the method that produces the string
corresponding to the receipt and display it in the console. (You are only asked to write
the main method (not the other methods and constructors) and use the same notation
as in the class diagram).
3.3. Write the java code (use the same notation than in the class diagram):
- the method that returns the string corresponding to a single product
- the method returning the string corresponding to a "bundle" product
- the method of a cart returning a string corresponding to the receipt. The method
should display for each item its price and the total price of the cart.

4. Exercice: find the errors


4.1. We consider the following files: [Link] and [Link]. The picture shows the
location of the files in terms of package. These files contain 6 errors. Identify them and
propose a way to correct them.

[Link]

package heritage;
public class Livre {
private String auteur;
public Livre(String a) { auteur = a; }
}

Page 2 sur 4
[Link]

import [Link].*;
package [Link];

public class LivreErrors extends Livre, Object {


ArrayList<Page> pages;

public void addPage(Page p){ [Link](p); }

public static void main(String[] a){


LivreErrors e = new LivreErrors();
[Link](new Page());
}
}

public class Page {


private String contenu;
}

4.2. Identify and explain the error(s) existing in the following class.

[Link]

public class Livre {


public String auteur;

public Livre(String a) {
auteur = a;
}

public String getAuteur(){return auteur;}

public static void main(String[] args) {


[Link] = "Best Author";
Livre l = new Livre("JJS");
[Link]("Auteur = " + getAuteur());
}
}

Page 3 sur 4
5. Modeling
In this exercise, there is no need to write Java statements. All questions focus on
modeling the application as a UML diagram.

The recruitment department of a large company asks you to improve and automate the
management system of its offers of internships and jobs. This management includes
several aspects:
- publishing internship and job offers,
- browsing of published offers,
- applying to published offers,
- monitoring browsing,
- monitoring the applications,
- withdrawal of offers from the publication.
For all the proposed offers (job or internship), we would like to know: the title, the state,
the required skills and the opening and closing dates for application. Job offers require
experience while internship do not require any previous experience. The job offers also
mention the salary range (minimum and maximum). The skills are described using
keywords: a keyword consists of a simple label. For a given offer, a skill may be specified
as mandatory or desired. For improving browsing, states are related to other states in
order to specify their closeness.
The search for offers can be done in different ways. The most common scenarios are:
• Looking for offers with respect to a set of skills and in some specific state. The
relevant offers should be sorted according to a score of soundness (expressed as
a percentage): the score is based on the intersection between the set of searched
skills and the set of skills of the offer.
• Looking for the offers o which are close from a reference offer r:
• if offer o is an internship then the closeness score with r is computed with
respect to the state and the score of soundness based on skills:
• if offer o is a job offer the score is not only based on skills and state but
should also consider the experience and the salary.
Any applicant should provide: contact details of the person (surname, first name and
email address), a list of skills and a mini-CV.

5.1. Draw the Class Diagram corresponding to the system described above. This diagram
must highlight the attributes and methods with parameters. If the links between
classes are unidirectional, the meaning must be specified.

Page 4 sur 4

You might also like