如何创建一个程序,该程序应打印出数组中正整数的数字,文本上写着“有___正数”。 [英] How to create a program that should print out the number of positive integers in the array with text that says “there are ___ positive numbers"

查看:66
本文介绍了如何创建一个程序,该程序应打印出数组中正整数的数字,文本上写着“有___正数”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

So I have a project where I have to have Java print out a set of random numbers with some being negative and some being positive which I have done, but the next part of the assignment I have to have the Program print out a text saying "there are ____ positive numbers" with the correct amount of positive numbers each time





我尝试了什么:



我不知道该怎么办,因为这是一个高中项目,我们的老师从未解释过如何去关于这样做,所以是的,我不知道我在寻找什么。



What I have tried:

I don't know what to try exactly because this is a highschool project and our teacher never explained anything on how to go about doing this so yeah I don't know what I'm looking for.

推荐答案

开发(甚至编码)不是解释任何关于如何要做到这一点,它是关于学习和使用给你土壤的心理过程 - 而不仅仅是编写代码。



这个 - 可能令人惊讶 - 是你一天做很多次的事情。举个例子:从你现在的位置到达巴黎的埃菲尔铁塔。这很难,不是吗?但是你可以这样做,如果你想到它,即使是来自美国。首先,您需要整理护照,可能是欧盟签证,双向机票,巴黎某处,机场,衣服,包装,钱。也许你的父母允许。没有一个是不可能的 - 甚至是那么困难 - 只是它们的组合都像一个项目看起来令人生畏。



你可以做到 - 你知道。这只是将问题分解为较小步骤并依次处理每个问题的情况,使用您已知的充实每一步。让大脑中的心理模式固定下去;连线接线;并且你给自己一个强大的工具,可以处理所有问题。



你的作业是一回事:把它分解成更小的步骤,并在你执行它们时实现它们能够。如果你不能把它分成更小的步骤并尝试它们。你将到达那里。
Development (and even "coding") is not about "explaining anything on how to go about doing this", it's about learning and using the mental processes that give you soilutions - and not just to writing code.

This - probably surprisingly - is something that you do many times a day. Take an example: "Get from your current location to the Eiffel Tower in Paris". That's difficult, isn't it? But you could do that, if you thought about it, even from the USA. First, you would need to sort out a passport, possibly a EU visa, air tickets in both directions, somewhere to stay in Paris, a ride to the airport, clothes, packing, money. And possibly your parents permission. None of those are impossible - or even that difficult - it's just the combination of them all as a "project" looks daunting.

You could do it - you know that. It's just a case of breaking the problem down into smaller steps and working on each in turn, using what you already know to "flesh out" each step. Get the mental "pattern" fixed in your brain; the "wiring" connected up; and you give yourself a powerful tool that works on all problems.

You homework is the same thing: break it down into smaller steps, and implement each of them when you can. If you can't break that into smaller steps and try them. You'll get there.


设置一个计数器,每次你得到一个正数加1到柜台。您也可以对负数做同样的事情。
Set up a counter and every time you get a positive number add 1 to the counter. You could also do the same for negative numbers.


Quote:

...我做过的,但作业的下一部分...

... which I have done, but the next part of the assignment ...



在这里,我们不做你的作业,我们帮你修复你的代码,但你必须展示你做了什么。


Here, we don't do your homework, we help you fix your code, but you have to show what you have done.

引用:

我不知道该怎么办,因为这是一个高中项目而我们的老师从未解释过关于如何去做的任何事情所以是的,我不知道我在寻找什么。

I don't know what to try exactly because this is a highschool project and our teacher never explained anything on how to go about doing this so yeah I don't know what I'm looking for.



想想如何手动解决问题,重新阅读课程,找到与你需要的行为类似的代码,然后调整代码。

试验学习编程是一种很好的方式,但只有你能做到。


Think on how you would solve the problem by hand, reread your courses find code with similar behavior to what you need, then adapt the code.
Experimenting is a great way to learn programming, but only you can do it.


这篇关于如何创建一个程序,该程序应打印出数组中正整数的数字,文本上写着“有___正数”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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