Giter Club home page Giter Club logo

coding_pal's Projects

car- icon car-

In object class PowerStation, there is a private instance field of double type called powerPrice. The field is set in the constructor. The field can be accessed through the corresponding getter and setter methods. Another object class - called ElectricCar has private instance fields called carMake (String), powerConsumption (double) per 100 km (kWh/100km), chargingTime in minutes (int), distance (int) that indicates the distance in km that is possible to drive per one charge, and station (PowerStation). In the class, there is a constructor that sets all the fields. In the class, there are some methods as well: getters and setters for accessing chargingTime and station (in the setter of chargingTime, there should be a check for data validity) an instance method without parameters and of double return type called payment100 - the method returns the price per 100-km drive (formula: power consumption times price for the power) an instance method of double return type called payment - the method has one parameter of int data type for the distance in km and returns the price for the trip by the car (formula: trip distance times the price per 100-km drive divided by 100) (use the corresponding method) an instance method of double return data type called tripDuration - the method has two parameters: the distance of the trip in km (int) and the average speed in km/h (double); the method tripDuration returns the time spent on the trip (formula: (tripDistance/distance)*chargingTime (in hours!) + tripDistance/speed) method toString that prints info about cars in a readable way; the output must contain info about the price per 100 km (use the corresponding method) Finally, create a client class with the main method. Create an instance of class PowerStation who sells power for 0.15 eur/kWh. Also create instances of class ElectricCar. In the client class, demonstrate the calls of different instance methods. The output must always contain a clear and understandable comment about the output info.

project- icon project-

this was the project for Python course ( Tartu university)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.