⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookstore.java

📁 构建网上购书最优联盟 此篇文章重在构建囊括最多变量因素的网上购书联盟。计算最优则变成了不断测试不断更改变量的统计型问题。而联盟要求的最低构建要素是: &#61548 联盟中心到站点的运输费
💻 JAVA
字号:
package tomato;

import java.util.*;

public class Bookstore {
  
  private String d_name;
  private Location d_location;
  private Vector d_sellbook = new Vector();
  
  public Bookstore(String name,Location location){
    
    d_location = location;
    d_name = name;
                                                                                                                       
    Initial();                                                                                                            	
  } 
  
  private void Initial(){
    
    Book InsideVisualCplusplus_dotNet = new Book((String)"InsideVisualCplusplus_dotNet",120,new BookofComputer()); 
    Book Essential_dotNet= new Book((String)"Essential_dotNet",48,new BookofComputer());                           
    Book Essential_COM = new Book((String)"Essential_COM",49,new BookofComputer());                                
    Book MaozeDong = new Book((String)"MaozeDong",56,new BookofHistory());

    
    Add(InsideVisualCplusplus_dotNet);                                                                             
    Add(Essential_dotNet);                                                                                         
    Add(Essential_COM);                                                                                            
    Add(MaozeDong);               
    	
  }
  
  public void Add( Book book ){
        
    GetVector().addElement( book );
    
  }
  
  public void Remove( Book book ){
    
    GetVector().removeElement(book);

 }
  
  public Location GetLocation(){
  
     return d_location;	
  }

  public Book SelectBook(int num){
  	
      return  (Book)GetVector().elementAt(num);
    	
  }
  
  public static double SetperKmFreight(){
  	
      double d_perKmFreight = 0.0;
      System.out.print("4.Please Inupt the perKmFreight: ");
      d_perKmFreight = SavitchIn.readDouble();
      System.out.println("The perKmFreight is: "+d_perKmFreight);
      System.out.println();
      
      return d_perKmFreight;
     	
  }
  
  public String GetBookstorename(){
      
      return  d_name;
      	
  }
  
  public Vector GetVector(){
      
      return  d_sellbook;
      	
  }
  
  public void Display(){
  	
    for(int index = 0; index < GetVector().size(); index++){    
    	
    	 Book b = (Book)GetVector().elementAt(index);
    	 
    	 System.out.println("The No."+(index+1)+" Book ");      
    	 
    	 b.Display();  
    }	                                         
  }

  
  
  public static void main(String[]args){
    
    Location Chinapublocation = new Location(15,15);
   	
    Bookstore aTest = new Bookstore((String)"Chinapub",Chinapublocation);
        
    aTest.Display();
  	
  }
  
}









































































⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -