有人可以帮我解决这个问题吗?谢谢! [英] Can someone please help me figure this out ? thanks!

查看:53
本文介绍了有人可以帮我解决这个问题吗?谢谢!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

input: nouf chapter
//start
system.out.println("Enter a list of words ending in ' .':");
String word=input.next()
String first=word.substring(0,1);
while(!first.contains(".")){
if("aeiou".contains(first)){
System.out.print(word+""yay"");
}else{
int p=1
while (p<word.length()&&
!"aeiouy".contains(word.substring(p,p+1))
p++;
System.out.print(word.substring(p)+word.substring(0,p)+"ay");
}
word =input.next()
first = word.substring(0,1);
}
//end 





我尝试了什么:



i不明白,有人可以帮我理解,所以我可以解决它,谢谢。



What I have tried:

i don't understand it, can someone please help me understand it so i can solve it, thanks.

推荐答案

Quote:

代码。这是一个pig latin java中的代码和输入是nouf章节,我应该通过输入nouf chapter在表格中回答它

The code. It's a pig latin Code in java and the input is nouf chapter, and i'm supposed to answer it in a table by the input " nouf chapter "





不。我们不做你的功课:这是有原因的。它是在那里让你考虑你被告知的事情,并试着理解它。它也在那里,以便你的导师可以确定你在哪里弱,并更加注重补救行动。



亲自尝试,你可能会发现它并不像你想象的那么难!



如果你遇到一个特定的问题,那么请询问,我们会尽力帮助。但我们不打算为你做这一切!



No. We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


建议:你应该学习缩进,它有助于阅读源代码。

Advice: you should learn about indentation, it helps reading source code.
system.out.println("Enter a list of words ending in ' .':");
String word=input.next()
String first=word.substring(0,1);
while(!first.contains(".")){
	if("aeiou".contains(first)){
		System.out.print(word+""yay"");
	}else{
		int p=1
		while (p<word.length()&&
		!"aeiouy".contains(word.substring(p,p+1))
			p++;
		System.out.print(word.substring(p)+word.substring(0,p)+"ay");
	}
	word =input.next()
	first = word.substring(0,1);
}





当你不明白你的代码是什么时为什么它做它做的事情,答案是调试器

使用调试器来查看代码正在做什么。只需设置断点并查看代码执行情况,调试器允许您逐行执行第1行并在执行时检查变量,这是一个令人难以置信的学习工具。



调试器 - 维基百科,免费的百科全书 [ ^ ]

http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html [ ^ ]

https://www.jetbrains.com/idea/help/debugging-your- first-java-application.html [ ^ ]

调试器在这里向您展示您的代码正在做什么,您的任务是与它应该做什么进行比较。

调试器中没有魔法,它没有发现错误,它只是帮助你至。当代码没有达到预期的效果时,你就会接近一个错误。



When you don't understand what your code is doing or why it does what it does, the answer is debugger.
Use the debugger to see what your code is doing. Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute, it is an incredible learning tool.

Debugger - Wikipedia, the free encyclopedia[^]
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html[^]
https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html[^]
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't find bugs, it just help you to. When the code don't do what is expected, you are close to a bug.


这篇关于有人可以帮我解决这个问题吗?谢谢!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆