#include <iostream> #include <cstring> using namespace std; class Point { private: int x,y; public: Point(int,int); void SetPoint(int,int); int GetX(){return x;} int GetY(){return y;} void Print(); }; class Circle:public Point { private: doubl…
#29.编写一个Java应用程序,设计一个汽车类Vehicle,包含的属性有车轮个数 wheels和车重weight.小车类Car是Vehicle的子类,其中包含的属性有载人数 loader.卡车类Truck是Car类的子类,其中包含的属性有载重量payload.每个 类都有构造方法和输出相关数据的方法.最后,写一个测试类来测试这些类的功 能. package hanqi; public class Vehicle { private int wheels; private int weight…
设计一个有getMin功能的栈 设计一个具有getMin功能的栈,可以返回栈中的最小的元素,可以使用现有的栈的数据结构,要求pop/push/getMin操作的时间复杂度是O(1). package com.test; import java.util.Stack; /** * Created by Demrystv. */ public class GetMinStack { //定义两个栈,一个存放正常的数据,一个存放最小值 Stack<Integer> stackData = new S…