<java>设计一个Account类

设计一个Account类。Java。不知道为啥运行不出来啊啊啊啊啊啊。。。。。。

找不到或无法加载主类 ComputerAvg    我也搞不懂是怎么回事,尝试了好几种方法都没有用诶。

/**
 * 设计一个Account类,(课本P306页,9.7)包括:
 * 一个名为id的int类型私有数据域(默认值为0)
 * 一个名为balance的double类型的私有数据域(默认值为0)
 * 一个名为annualInterestRate的double类型私有数据域存储当前利率(默认值为0).假设所有的账户都有相同的利率
 * 一个名为deteCreated的Date类型的私有数据域,存储账户的开户日期
 * 一个用于创建默认账户的无参构造方法
 * 一个用于创建带特定id和初始余额的账户的构造方法
 * id、balance和annualInterestRate的访问器和修改器
 * dateCreated的访问器
 * 一个名为getMonthlyInterestRate()的方法、返回月利率
 * 一个名为withDraw的方法,从账户提取特定数额
 * 一个名为deposit的方法向账户存储特定数额
 * @author 王沐风
 *
 */
import java.sql.Date;
import java.util.Scanner;
public class AccountClass {
	//名为id的int类型的私有数据域,账户
	private int id=0;
	//名为balance的double类型的私有数据域,余额
	private double balance=0;
	//名为annualInterstRate的double类型的私有数据域,利率
	private double annualInterestRate=0;
	//名为dateCreate的Date类型的私有数据域
	private Date dateCreate;
	//用于创建默认账户的无参构造方法
	public AccountClass(){
	}
	//用于创建带特定id和初始余额的账户的构造方法
	public AccountClass(int id,double balance){
		this.id = id;
		this.balance=balance;
	}
	
	//id、balance和annualInterestRate的访问器和修改器
	public int getid(){
		return id;
	}
	public void setid(int id){
		this.id=id;
	}
	public double getbalance(){
		return balance;
	}
	public void setbalance(double balance){
		this.balance=balance;
	}
	public double getannualInterstRate(){
		return annualInterestRate;
	}
	public void setannualInterstRate(double annualInterstRate){
		this.annualInterestRate=annualInterstRate;
	}
	
	//dateCreated的访问器
	public Date dateCreate(){
		return dateCreate;
	}
	
	//一个名为getMonthlyInterestRate()的方法、返回月利率
	public double MonthlyInterestRate(){
		double Monthly=0;
		if(0==annualInterestRate){
			System.out.println("Your annualInterestRate have not set:");
		}else{
			Monthly=annualInterestRate/12;
		}
		return Monthly;
	}
	
	//名为withDraw的方法,从账户提取特定数额
	public void withDraw(double Money){
		if(Money<=balance){
			this.balance=getbalance()-Money;
		}else{
			System.out.println("Sorry,your balance have not so much balance!");
		}
	}
	
	//名为deposit的方法向账户存储特定数额
	public void deposit(double money){
		if(0!=money){
			this.balance=getbalance()+money;
		}else{
			System.out.println("Please enter effective!");
		}
	}
	
	//测试
	public void main(String[] args){
		AccountClass myaccount=new AccountClass();//(170321,10000);
		myaccount.setid(321);//修改id
		int id=getid();//修改id
		myaccount.setbalance(10000);
		double balance=getbalance();//修改账户余额
		System.out.println("The id of myaccount is "+id+" the balance is "+balance);
		
		Date date=myaccount.dateCreate();//访问账户日期
		System.out.println("The date of create id is "+date);
		
		setannualInterstRate(0.0045);//修改年利率,返回年利率
		double annualInterstRate=myaccount.getannualInterstRate();
		System.out.println("The annualInterestRate is "+annualInterstRate);
		
		double Monthly=myaccount.getbalance();//返回月利率
		System.out.println("The monthlyannualInterestRate is "+Monthly);
		
		System.out.println("Please enter the money of withDraw :");
		Scanner input = new Scanner(System.in);
		double money=input.nextDouble();
		myaccount.withDraw(money);//取钱
		System.out.println("The balance is "+balance);
		
		System.out.println("Please enter the money of deposite :");
		Scanner input1 = new Scanner(System.in);
		double moneydeposite=input1.nextDouble();
		myaccount.deposit(moneydeposite);
		System.out.println("The balance is "+balance);
		
	}
	
}

 

### LlamaIndex 多模态 RAG 实现 LlamaIndex 支持多种数据类型的接入与处理,这使得它成为构建多模态检索增强生成(RAG)系统的理想选择[^1]。为了实现这一目标,LlamaIndex 结合了不同种类的数据连接器、索引机制以及强大的查询引擎。 #### 数据连接器支持多样化输入源 对于多模态数据的支持始于数据收集阶段。LlamaIndex 的数据连接器可以从多个异构资源中提取信息,包括但不限于APIs、PDF文档、SQL数据库等。这意味着无论是文本还是多媒体文件中的内容都可以被纳入到后续的分析流程之中。 #### 统一化的中间表示形式 一旦获取到了原始资料之后,下一步就是创建统一而高效的内部表达方式——即所谓的“中间表示”。这种转换不仅简化了下游任务的操作难度,同时也提高了整个系统的性能表现。尤其当面对复杂场景下的混合型数据集时,良好的设计尤为关键。 #### 查询引擎助力跨媒体理解能力 借助于内置的强大搜索引擎组件,用户可以通过自然语言提问的形式轻松获得所需答案;而对于更复杂的交互需求,则提供了专门定制版聊天机器人服务作为补充选项之一。更重要的是,在这里实现了真正的语义级关联匹配逻辑,从而让计算机具备了一定程度上的‘认知’功能去理解和回应人类意图背后所蕴含的意义所在。 #### 应用实例展示 考虑到实际应用场景的需求多样性,下面给出一段Python代码示例来说明如何利用LlamaIndex搭建一个多模态RAG系统: ```python from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader, LLMPredictor, PromptHelper, ServiceContext from langchain.llms.base import BaseLLM import os def create_multi_modal_rag_system(): documents = SimpleDirectoryReader(input_dir='./data').load_data() llm_predictor = LLMPredictor(llm=BaseLLM()) # 假设已经定义好了具体的大型预训练模型 service_context = ServiceContext.from_defaults( chunk_size_limit=None, prompt_helper=PromptHelper(max_input_size=-1), llm_predictor=llm_predictor ) index = GPTSimpleVectorIndex(documents, service_context=service_context) query_engine = index.as_query_engine(similarity_top_k=2) response = query_engine.query("请描述一下图片里的人物表情特征") print(response) ``` 此段脚本展示了从加载本地目录下各类格式文件开始直到最终完成一次基于相似度排序后的top-k条目返回全过程。值得注意的是,“query”方法接收字符串参数代表使用者想要询问的内容,而在后台则会自动调用相应的解析模块并结合先前准备好的知识库来进行推理计算得出结论。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值