NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.mycompany.car;

public class Car {

public interface ICarInfo {
public String SearchByCode(String code);
public String SearchByName(String name);
public double SearchByPrice();
}

public class CarC {
private String name;
private String code;
private double price;

public CarC(String name, String code, double price) {
this.name=name;
this.code=code;
this.price=price;
}

public String getName() {
return name;
}
public void setName(String name) {
this.name=name;
}

public String getCode() {
return code;
}
public void setCode(String code) {
this.code=code;
}

public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price=price;
}
}

public static class LowCar extends CarC implements ICarInfo {
public LowCar(String name, String code, double price)
{
super(name,code,price);
}
@Override
public String SearchByCode(String code) {
return "1";
}
@Override
public String SearchByName(String name) {
return "Low FIAT";
}
@Override
public double SearchByPrice() {
return super.getPrice();
}
}

public static class MidCar extends CarC implements ICarInfo {
public MidCar(String name, String code, double price)
{
super(name,code,price);
}
@Override
public String SearchByCode(String code) {
return "2";
}
@Override
public String SearchByName(String name) {
return "Mid FIAT";
}
@Override
public double SearchByPrice() {
return super.getPrice()*2;
}
}

public static class HighCar extends CarC implements ICarInfo {
public HighCar(String name, String code, double price)
{
super(name,code,price);
}
@Override
public String SearchByCode(String code) {
return "3";
}
@Override
public String SearchByName(String name) {
return "High FIAT";
}
@Override
public double SearchByPrice() {
return super.getPrice()*3;
}
}

public static void main(String[] args) {
ICarInfo[] list=new ICarInfo[3];

ICarInfo car01=new LowCar("Murat 131", "mrt_131", 200000);
ICarInfo car02=new MidCar("FIAT 126 Bis", "fiat_126_bis", 275000);
ICarInfo car03=new HighCar("Mustang 69 Mach1", "mstng_69_m1", 900000);

list[0]=car01;
list[1]=car02;
list[2]=car03;

for (ICarInfo ICarInfo:list) {
if(ICarInfo.SearchByPrice()<=4000) {
System.out.println(((CarC)ICarInfo).getName());
System.out.println(((CarC)ICarInfo).getCode());
System.out.println(((CarC)ICarInfo).getPrice());
}
}
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.