473,586 Members | 2,682 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array, Classes And Constructor Method

1 New Member
1) In a class named AnyIntegers, prompt the user to enter 100 integers into a two-dimensional array. Use a method countEvenNum of the class CollectEvenNumb er to determine the total even number stored in the array.

2) Write a class named GameScores that receives the score and player name through its constructor. Initialize and return these data. Write a class named MindGame that inherits GameScores class. Reads 100 player’s name and score from user. Identify total number of player whose score is 10.

I need help in these 2 questions using BlueJ. Thanks alot
Mar 30 '08 #1
3 2631
mia023
89 New Member
Write a Java program that creates 50 random numbers ranging 1 to 6 and store them in TWO dimension array. The program should keep track on the frequency of each of the numbers and creates the histogram as shown below:

Sample output
Random Numbers Frequency Histogram
1 9 ******
2 10 **********
3 7 *******
4 8 ********
5 10 **********
6 6 ******


I need help in this question using BlueJ. Thanks
use java.util for creating Random numbers and store them in the multidimensiona l array then use if else clause for the Frequency of each.
Mar 30 '08 #2
mia023
89 New Member
use java.util for creating Random numbers and store them in the multidimensiona l array then use if else clause for the Frequency of each.
for the 2nd problem you have to use a counter to keep track of the scores and increment it each time score is 10
Mar 30 '08 #3
r035198x
13,262 MVP
1) In a class named AnyIntegers, prompt the user to enter 100 integers into a two-dimensional array. Use a method countEvenNum of the class CollectEvenNumb er to determine the total even number stored in the array.

2) Write a class named GameScores that receives the score and player name through its constructor. Initialize and return these data. Write a class named MindGame that inherits GameScores class. Reads 100 player’s name and score from user. Identify total number of player whose score is 10.

I need help in these 2 questions using BlueJ. Thanks alot
... and what have you done so far?
Mar 31 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
1440
by: Mike P | last post by:
I have, what should be, a simple scope problem. Can you help me fix this? I'm trying to end up like this: originalArray = and newArray = . Instead I wind up like this: originalArray = and newArray = . Here's my code:
24
10501
by: Chad Z. Hower aka Kudzu | last post by:
I need to store a list of classes, not the instances of the classes. I had planned to use an array, but can use a collection or some other form if more appropriate. The problem I am having is that I cannot find the C# syntax I need to reference a class type. public <class type> PowerTour = new <class type> {form1, form2}; Then later I...
2
2187
by: david | last post by:
Well, as a matter of fact I_HAD_MISSED a basic thing or two, anyway, although Ollie's answer makes perfectly sense when dealing with classes, it doesn't seem to me to apply as well if you have to instantiate an array of structures; consider the following useless code : using System; struct MyPointS
4
1464
by: Eric A. Johnson | last post by:
For the following code: ' return String representation of CTriangleShape Public Overrides Function ToString() As String ' use MyBase reference to return CShape String Return MyBase.ToString & ";" & vbCrLf & _
11
3814
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you experts. I would like to produce Javascript classes that can be "subclassed" with certain behaviors defined at subclass time. There are plenty of...
4
9678
by: mflll | last post by:
I am looking into the different techniques of handling arrays of edit boxes in Java Script. The first program below works fine. However, are there better ways of doing this, where the person writing the JavaScript doesn't have to pass the index in the "onChange" event name. I thought that one might be able to use "this.value" or...
3
4729
sammyboy78
by: sammyboy78 | last post by:
I'm trying to display an array of objects using a GUI. My instructions are that the CD class and it's sublcass don't need to change I just need to modify class CDInventory to include the GUI. I'm not even sure if the way I've written this is going to work but anyway, I keep getting a compilation error that says: C:\Documents and...
6
3872
sammyboy78
by: sammyboy78 | last post by:
I'm trying to display my array of objects in a GUI. How do I get JLabel to refer to the data in my objects? I've read my textbook and some tutorials online I just cannot get this. Plus all the examples I've seen are creating the information that will be displayed from scratch, while I have to use my previously created classes and add a GUI to it....
4
2216
by: Zerofury | last post by:
Okay here's what i'm trying to do. I want to create an array and fill it with objects, so that when i create a method to alphabetize them, all of the pieces (the price, name, ect) don't get all out of order and correlate to each other. Here is my code so far... any ideas? Just need to create an array of classes. How do i get all these items i...
12
11048
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed!...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.