×

java语言程序设计基础篇课后答案

java语言程序设计基础篇课后答案(您好!我想要《Java语言程序设计基础篇》第六版的练习题和编程题答案,谢谢了.)

admin admin 发表于2023-12-22 09:17:41 浏览34 评论0

抢沙发发表评论

大家好,今天小编来为大家解答以下的问题,关于java语言程序设计基础篇课后答案,您好!我想要《Java语言程序设计基础篇》第六版的练习题和编程题答案,谢谢了.这个很多人还不知道,现在让我们一起来看看吧!

本文目录

您好!我想要《Java语言程序设计基础篇》第六版的练习题和编程题答案,谢谢了.

:1.No permission ————has for anybodyto enter the building.(N M ET1988)A.been given B.givenC.to give D.be givingA。析语境可知,该空表示被给,应用被动语态,has后面应接been done。2.U ntil now,his hom ework has not————finished.A.being B.be C.been D.to beC。语境逻辑制约家庭作业是被完成的,因此该空应用被动语态,has后面应使用been done的形式。点评:现在完成时被动语态结构为has/have been done,使用has been done时主语为单数,使用have been done时主语为复数。解题时应首先分析语境逻辑确定现在完成时被动语态,然后对照其结构公式确定答案。3.The window————.Y ou need notwash it again.A.is w ashed B.was washedC.has been washed D.will be washed析:C。该句强调窗户已被清洗。4.It seem that dinner ____for a long time.A.is cooked B.has been cooked C.was cooked D had been cookedB.表示晚饭已经准备好了。对现在有影响。5。When my article ____.I’ll come to see you .A.is finished B is being finished C has been finished D will be finishedC 现在完成时被动语态代替将来完成时被动语态。1. I’m sorry, sir. Your recorder isn’t ready yet. It______in the factory. A. is being repaired B. is repaired C. has been repaired D. hasn’t repaired 本题并没有明确的时间状语,但从上文的意思看,“修理”这个动作正在进行;it指代上文提到的录音机,它和repair之间存在被动关系。因此应该使用现在进行时的被动语态。B、C两项是被动语态,但时态不对,因此,本题正确答案是A。 2. Some measures______to protect wildlife resources. A. are taking B. are taken C. are being taken D. being taken 解此题时首先要注意到词组take measures to do sth.,由于题干中把宾语measures提前,应该使用被动语态;句子的意思是“正在采取一些措施去保护野生资源”。在表达现在进行时的被动语态的结构中,选项A、B、D均不完整,正确答案应是C。 3. —Have you moved into the new house? —Not yet. The rooms______. A. are being painted B. are painting C. are painted D. are being painting 通过题干情景,我们不难看出,由于正在粉刷,因此还不能搬进新房子。分析选项,B项语态不对;C项时态不对;D项结构错误,所以正确答案应该是A。 4. A new building______at the other side of the street. Work started last year and the building is expected to open next year. A. is built B. is being built C. has built D. will be built 题干的后半部分告诉我们:“去年开工,预计明年竣工。”由此可知,大楼正在建设中,所以选项A、C、D时态均不对。正确答案应该是B。 5. It is well-known to us that a lot of rivers______by the factories. A. are polluting B. have been polluting C. are being polluting D. are being polluted 题干的意思是:“众所周知,许多河流正在被工厂污染。”说明了目前河流正在被污染的严重状况。A、B两项语态不对;C项结构错误,正确答案是D。 the man was being operated at that time .at that time we all being showed how to swim.the bridge was being repaired when we passed.the road was being repaired we had to make awhile the supper was being prepared the light at tha t time my classment was being showed how to use computers.the book was being translated by him this time last year. the question was been disgussed at the meeting yesterday afternoon. 过去进行时只找到例句,不好意思。

《Java语言程序设计基础篇》第六版的练习题和编程题答案

哥们我给你写完了,耽误了我半个小时的时间啊!你直接运行就可以了import java.awt.BorderLayout;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.Calendar;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextField;public class Constellation implements ActionListener{ private JFrame frame = null; private JTextField year = null; private JTextField month = null; private JTextField day = null; private JLabel label1 = null; private JLabel label2 = null; private JLabel label3 = null; private JPanel panel1 = null; private JPanel panel2 = null; private JButton button = null; private JTextField output = null; public static final String zodiacArr = { "猴", "鸡", "狗", "猪", "鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊" }; public static final String constellationArr = { "水瓶座", "双鱼座", "牡羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "魔羯座" }; public static final int constellationEdgeDay = { 20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22 }; /** * * 根据日期获取生肖 * * @return 11. */ public static String date2Zodica(Calendar time) { return zodiacArr; } /** * * 根据日期获取星座 * * @param time * * @return */ public static String date2Constellation(Calendar time) { int month = time.get(Calendar.MONTH); int day = time.get(Calendar.DAY_OF_MONTH); if (day 《 constellationEdgeDay) { month = month - 1; } if (month 》= 0) { return constellationArr; } // default to return 魔羯 return constellationArr; } public Constellation(){ frame = new JFrame("计算生肖,星座"); year = new JTextField("",3); month = new JTextField("",3); day = new JTextField("",3); label1 = new JLabel("请输入年份:"); label2 = new JLabel(",请输入月份:"); label3 = new JLabel(",请输入日期:"); button = new JButton("查看结果"); button.addActionListener(this); panel1 = new JPanel(); panel1.setLayout(new FlowLayout(FlowLayout.CENTER)); panel1.add(label1); panel1.add(year); panel1.add(label2); panel1.add(month); panel1.add(label3); panel1.add(day); panel1.add(button); frame.setLayout(new BorderLayout()); frame.add(panel1,BorderLayout.NORTH); panel2 = new JPanel(); output = new JTextField("",40); panel2.add(output,JPanel.CENTER_ALIGNMENT); frame.add(panel2,BorderLayout.CENTER); frame.setSize(500, 100); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public void actionPerformed(ActionEvent e) { output.setText(""); int y = Integer.parseInt(year.getText()); int m = Integer.parseInt(month.getText()); int d = Integer.parseInt(day.getText()); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, y); calendar.set(Calendar.MONTH, m); calendar.set(Calendar.DAY_OF_MONTH, d); String zodica = date2Zodica(calendar); String constellation = date2Constellation(calendar); String str = "您输入的日期为:"+y+"年-"+m+"-月"+d+"日,得到的生肖:"+zodica+",星座:"+constellation; output.setText(str); } //testcode public static void main(String args) { new Constellation(); }}

Java语言程序设计 基础篇第六版 (Y.Daniel Liang )的,第15 16章的编程题答案

(1)。public class TiaoSeBan extends JFrame {JPanel panel1;JPanel toppanel;JPanel bottompanel;JPanel colorLabpanel;JPanel colorScrollBarpanel;JLabel redLable;JLabel greenLable;JLabel blueLable;JLabel showColorLable;JScrollBar redScrollBar;JScrollBar greenScrollBar;JScrollBar blueScrollBar;void init(){ panel1=new JPanel(); toppanel=new JPanel(); bottompanel=new JPanel(); colorLabpanel=new JPanel(); colorScrollBarpanel=new JPanel(); redLable=new JLabel("Red"); greenLable =new JLabel("Green"); blueLable=new JLabel("Blue"); showColorLable=new JLabel("Show Colors"); redScrollBar =new JScrollBar(JScrollBar.HORIZONTAL , 0, 100,0,255); greenScrollBar =new JScrollBar(JScrollBar.HORIZONTAL , 0,100,0,255); blueScrollBar =new JScrollBar(JScrollBar.HORIZONTAL , 0, 100,0,255);}TiaoSeBan(){super();init();setLayout(new BorderLayout());add(toppanel,BorderLayout.CENTER);add(bottompanel,BorderLayout.SOUTH); showColorLable.setHorizontalAlignment(SwingConstants.CENTER);toppanel.setLayout(new BorderLayout());toppanel.add(showColorLable,BorderLayout.CENTER);bottompanel.setLayout(new BorderLayout());bottompanel.add(colorLabpanel,BorderLayout.WEST);bottompanel.add(colorScrollBarpanel,BorderLayout.CENTER);colorLabpanel.setLayout(new GridLayout(3, 1));colorLabpanel.add(redLable);colorLabpanel.add(greenLable);colorLabpanel.add(blueLable); colorScrollBarpanel.setLayout(new GridLayout(3, 1));colorScrollBarpanel.add(redScrollBar);colorScrollBarpanel.add(greenScrollBar);colorScrollBarpanel.add(blueScrollBar);redScrollBar.addAdjustmentListener(new AdjustmentListener() {public void adjustmentValueChanged(AdjustmentEvent e) {reSetColor(showColorLable);}});greenScrollBar.addAdjustmentListener(new AdjustmentListener() {public void adjustmentValueChanged(AdjustmentEvent e) {reSetColor(showColorLable);}});blueScrollBar.addAdjustmentListener(new AdjustmentListener() {public void adjustmentValueChanged(AdjustmentEvent e) {reSetColor(showColorLable);}});}void reSetColor(JLabel label){label.setForeground(new Color(redScrollBar.getValue(), greenScrollBar.getValue(), blueScrollBar.getValue()));}public static void main(String args) {TiaoSeBan frame=new TiaoSeBan();frame.setTitle("tiaoseban");frame.setLocationRelativeTo(null);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setSize(200,200);frame.setVisible(true);}}(2)public class jisuanq extends JApplet implements ActionListener { private JTextField jtf = new JTextField(10); private boolean newNumber = true; private int result = 0; private String op = "="; public void init() { JPanel p = new JPanel(); p.setLayout(new BorderLayout()); JPanel westPanel = new JPanel(); westPanel.setLayout(new GridLayout(5, 0)); westPanel.add(new JButton(" ")); westPanel.add(new JButton("MC")); westPanel.add(new JButton("MR")); westPanel.add(new JButton("MS")); westPanel.add(new JButton("M+")); Panel centerPanel = new Panel(); centerPanel.setLayout(new BorderLayout()); Panel p1 = new Panel(); Panel p2 = new Panel(); p1.setLayout(new FlowLayout(FlowLayout.RIGHT)); p1.add(new JButton("Back")); p1.add(new JButton("CE")); p1.add(new JButton("C")); p2.setLayout(new GridLayout(4, 5)); JButton bt; p2.add(bt = new JButton("7")); bt.addActionListener(this); p2.add(bt = new JButton("8")); bt.addActionListener(this); p2.add(bt = new JButton("9")); bt.addActionListener(this); p2.add(bt = new JButton("/")); bt.addActionListener(this); p2.add(bt = new JButton("sqrt")); bt.addActionListener(this); p2.add(bt = new JButton("4")); bt.addActionListener(this); p2.add(bt = new JButton("5")); bt.addActionListener(this); p2.add(bt = new JButton("6")); bt.addActionListener(this); p2.add(bt = new JButton("*")); bt.addActionListener(this); p2.add(bt = new JButton("%")); bt.addActionListener(this); p2.add(bt = new JButton("1")); bt.addActionListener(this); p2.add(bt = new JButton("2")); bt.addActionListener(this); p2.add(bt = new JButton("3")); bt.addActionListener(this); p2.add(bt = new JButton("-")); bt.addActionListener(this); p2.add(bt = new JButton("1/x")); bt.addActionListener(this); p2.add(bt = new JButton("0")); bt.addActionListener(this); p2.add(bt = new JButton("+/-")); bt.addActionListener(this); p2.add(bt = new JButton(".")); p2.add(bt = new JButton("+")); bt.addActionListener(this); p2.add(bt = new JButton("=")); bt.addActionListener(this); centerPanel.add(p2, BorderLayout.CENTER); centerPanel.add(p1, BorderLayout.NORTH); p.add(centerPanel, BorderLayout.CENTER); p.add(westPanel, BorderLayout.WEST); getContentPane().setLayout(new BorderLayout()); getContentPane().add(p, BorderLayout.CENTER); getContentPane().add(jtf, BorderLayout.NORTH); } public void actionPerformed(ActionEvent e) { String actionCommand = e.getActionCommand(); if (’0’ 《= actionCommand.charAt(0) && actionCommand.charAt(0) 《= ’9’) { if (newNumber) { jtf.setText(actionCommand); newNumber = false; } else { jtf.setText(jtf.getText() + actionCommand); } } else if (newNumber) { if (actionCommand.equals("-")) { jtf.setText("-"); newNumber = false; } else op = actionCommand; } else { execute(); op = actionCommand; } } void execute() { int number = new Integer(jtf.getText()).intValue(); System.out.println("number " + op); switch (op.charAt(0)) { case ’+’: result += number; break; case ’-’: result -= number; break; case ’*’: result *= number; break; case ’/’: result /= number; break; case ’%’: result %= number; break; case ’=’: result = number; } System.out.println("result "+result); jtf.setText(new Integer(result).toString()); newNumber = true; } /**This main method enables the applet to run as an application*/ public static void main(String args) { // Create a frame JFrame frame = new JFrame("Exercise16_8"); // Create an instance of the applet jisuanq applet = new jisuanq(); // Add the applet instance to the frame frame.getContentPane().add(applet, BorderLayout.CENTER); // Invoke init() and start() applet.init(); applet.start(); // Display the frame frame.setSize(300, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); }}

求JAVA语言程序设计作业答案

3、C;4、A;6、A;7、A;8、D;12、A;13、B;14、B;17、A;18、D;19、D;20、A; 4题:A很明显是错误的,java程序在运行前需要编译成字节码文件,才能运行。 14题:在Java语言中,标识符是以字母、下划线或美元符开头,由字母、数字、下划线或美元符组成的字符串。标识符区分大小写,长度没有限制。除以上所列几项之外,标识符中不能含有其他符号,也不允许插入空格。 17题:向main方法传入的是三个参数接收后args={"aaa","bb","c"} int k1=args.length;//得到数组元素个数,为3 int k2=args.length();//得到数组中下标为1的元素字符数(即第二个元素) 18题:String s1="AbcD"; String s2=s1.toLowerCase(); 作用是把字符串全部转为小写,所以选D 19题:函数重载定义 1:保持相同的功能,并且有相同的函数名2、重载方式为:返回值类型不同,形参个数不同同,形参类型不同。在满足一的前提下,二中三个条件任意一个,或其中多个的任意组合都是重载 20题:BB继承了AA并且重写了Show()方法。父类AA实例化了a,所以a.Show()调用的是父类中的Show方法,显示:我喜欢Java!子类BB实例化了b,所以b.Show()调用子类BB中的Show方法,显示:我喜欢C++!

java语言面向对象程序设计马俊版课后习题答案

首先你要了解,JAVA是什么软件,有什么用?答:它是个面向网络的程序设计语言,用来让程序员创建应用程序,这些应用程序可以通过网络下载,而且可在任何计算平台上安全地运行。Java作为一个分布式的,面向对象的程序设计语言,可以让位于任何地方的任何计算机应用网络上的应用程序。其实每次遇到不会的都来求助是很不方便的 如果你想了解和免费学习更多的JAVA编程,成为一名真正的JAVA高手,你可以来这个qun,前面三个数是四二六 中间是三九六 后面是二八四把这串数字连起来就可以了,这是一个高手的学习qun,在这里你可以学习到书上学不到的知识,还有大牛相互讨论并指导你解答,免费学习资料共享在qun文件里。同C++一样, Java是个面向对象的语言,这就意味着软件可以以部件的形式编制,为了满足某种任务,软部件可以互相配合。Java适宜于互联网的开发应用,其中一个原因是它使用了虚拟机,虚拟机是个用来解释Java指令的软件包,Java的虚拟机策略就相当于世界语,这是个人造的国际语言,目的是使得不同语言之间的翻译和沟通更加容易。

关于java语言程序设计基础篇课后答案到此分享完毕,希望能帮助到您。