Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Es6 practical Exams

Instructions

 Answer all questions, add comments where necessary.


 Create a new folder with your name
 Add a new file for each question in the folder.
 When completed, zip the folder and send to umar@lincoln.edu.ng

Question 1:
In Nigeria, Celsius is predominantly used to measure temperature. Imagine you're in a foreign
country that employs Fahrenheit for temperature readings. Develop a JavaScript program to
facilitate the conversion of temperatures between Fahrenheit and Celsius, adhering to the
instructions outlined below:

1. Write an arrow function celsiusToFahrenheit that converts a temperature from Celsius to


Fahrenheit. Use the formula below:
Fahrenheit= (Celsius * 9/5)+32
2. Write an arrow function FahrenheitTocelsius that converts a temperature from Fahrenheit
to Celsius. Using the formula below
Celsius= (Fahrenheit−32) * 5/9

Convert 25°C to Fahrenheit.


Convert 77°F to Celsius

Question 2:
You have younger siblings that you’ll like to spend most of their time teasing their brains instead
of playing around. Create a simple quiz using JavaScript to help them stimulates their brain. Use
the following steps in creating such:

1. Use a class constructor that’ll take in the questions and other necessary parameters and
initialized them.
2. Create not less than 5 quiz questions using the class constructor.
3. Use the prompt method to allow your siblings to choose the correct answer amongst the
options you provided for each question.
4. Add a counter that’ll keep track of all the correct answers your sibling got and show the
total points at the end of the quiz. Assign 2 points per correct answer.
5. Print a string to show ‘Wrong Answer’ whenever they select the wrong answer.
Question 3:
Emily and her study group often celebrate their academic achievements by going out on
weekends. They explore different eateries every time, and their recent outings resulted in total
bills of 15000, 27000, 62000, and 37000 Naira. Whenever they experience excellent service,
Emily likes to acknowledge it by giving a tip to the restaurant staff. She tips 1.5% of the bill if
it’s greater than 50000, 2% of the bill if it's between 20000 to 50000, and 2.5% of the bill if is
lower than 20000. Create an object with a tip calculator that computes and sums up the total tip
Emily paid during their outings.

Question 4:
You are tasked with building a system to manage vehicles at a car dealership. Different types of
vehicles, such as cars and motorcycles, need to be represented in your system. Each vehicle
shares common properties like make, model, and year, but they also have specific properties.

1. Create a class Vehicle with a constructor that takes parameters for make, model, and
year. Initialize these properties in the constructor.

2. Extend the Vehicle class to create a subclass Car in a new module that includes an
additional property for the number of doors. Ensure that the Car class properly inherits
from the Vehicle class.

3. Implement a method displayInfo in both the Vehicle and Car classes to display
information about the vehicle, including the additional properties for Car.

4. Create an instance of Vehicle and an instance of Car. Display their information using the
displayInfo method.

You might also like