johnathan smith

Greenhorn
+ Follow
since Mar 30, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by johnathan smith

well iv been trying part a

and so far i have come up with



but im guessing the for statement is incorrect
any idea where its wrong?
thanks
16 years ago
hi

i have an exam coming up
and when looking at previous years papers i have realiaed that the questions are similar therefore I assume this years will be no exception.

i feel pretty confident about some questions but this one question i am struggling to come up with a solution for.

if anybody can help out that would be superb

The question opens with a class of a rectangle
it has methods to set the dimensions
return the width height and area and print these out

the question is

a) Write a method that takes as a parameter an array of Rectangle objects and prints out the details of every rectangle stored in this array.

b) Write a method that takes as a parameter an array of Rectangle objects and returns an array of the areas of the rectangles stored in this array

thanks
16 years ago
hi

i have a memory class and a cache class

i want to write a main class transfering data from the memory to the cache using direct mapping

if anybody could help me writing this id appreciate it very much

thanks

the code is below
memory class



cache class
16 years ago
hi

i am trying to write a program which manages a cache. The program takes address references in the range 0 .. 1023 and determines whether a given address reference is a hit or miss.
It also computes the Miss rate every time a miss is encountered
and at the end displays of the cache contents.

i have written a memory class with contains a 2d array and prints out random ints at each place in the array

i have also written a cache class which contains 4 arrays

i want to now is it possible to write it and miss rate methods in the cache class and print out the cache contents

any help would be greatly appreciated
thanks

the code for my classes is below:
memory class:


cache class
16 years ago
hi,

im trying to write a program to represent a memory and a cache

i have written a class for the memory containing a 2d array holding random integers - i will post the code for this below for you to gain an understanding

i now wish to write a cache class which contains 4 2d arrays

32x1 for validity bit (0 if the corresponding cache block is empty, 1 if it has stuff in)
32x1 for index
32x1 for tag
32x8 for the actual cache blocks

however, i am unsure of how to go about doing this
if anybody could offer any help or psuedo code id appreciate it very much

thanks

the code for the memory class is as follows:
16 years ago
hey,
i have a problem but dont know where to start

i want to construct a program which manages a 0.25kb cache
i want to write a class organising the cache using direct mapping and one using fully associative

the program takes address references in the range 0 .. 1023
and determines whether a given address reference is a hit or miss.
It also computes the Miss rate every time a miss is encountered
and at the end displays of the cache contents.

it also assumes that the address holds 8 bytes

any help/pseudo code would be much appreciated

thanks
16 years ago
hey

just wondering if anyone could tell me the benefits of using an ArrayList as oppose to a stack or a queue etc?

thanks
16 years ago
...or an error message is printed!

thanks
16 years ago
i assure you its definately cricket

what im wanting to do is as follows
when creating a Player obviously you enter the details
and if the user enters the more dismissials than the amound of games played (i.e this is impossible) then an excpetion this thrown

any idea how i can do this?
thanks
16 years ago
hey there guys
cheers for the help on my previous topic, was very much appreciated

i have a new problem now which any help would be very much appreciated
my class player takes information such as games played, times dismissed etc

i was wondering would i be able to throw an exception if the number of times dismissed is less than the games played??

my player class code is below
any help would be greatly apprecaited


thanks


[ April 22, 2007: Message edited by: johnathan smith ]
16 years ago
well, for instance

if i try the following code


i get an error which says

"cannot find symbol - variable getBattingaverage"

i want to print the batting average
any idea how?

thanks

[ I inserted some line breaks for readability - Jim ]
[ April 21, 2007: Message edited by: Jim Yingst ]
16 years ago
hi

i have a method in my class which calculates the batting average of a plyer
however i cant get it to print out.

my code is below for the class.
i have tried various things e.g "Batting average = " + getBattingaverage; etc

but cant get it to compile or print
the rest of the stuff prints out
would be grateful if anyone could show me where im going wrong

thanks

the code is as folls

[ April 21, 2007: Message edited by: Jim Yingst ]
16 years ago
thanks for the help

but i now want to write an add method to my club class which passes a Player and a Comparator and prints out the player information in decending order of batting average

how do i go about doing this?
any help is much appreciated

thanks
16 years ago
hi
i have the following comparator class written to compare to players in a team by batting averages

i would now like to write a method called add to my Club class which passes a Player and a comparator hense writing a main program which which prints information about each player in the club in decreasing order of batting average?

Club class contains an array list and also add and remove player methods

how would this be achieved?
any hints or pseudo code would be much apprecaited
thanks

the comparator code
16 years ago
Hello

forgive me as I have recently posted a topic about the same subject
however i feel it is best to start again to clear the situation up

this situation
i have a class called Person - this class records and returns firstname, surname, age and height of a person

i have a class called Player - this class records and returns information gamesplayed etc. it also inherits from Person.

i have a class called club this Class contains an ArrayList of players and the class also contains add and remove methods for the ArrayList.

i have a class called main which deals with printing out the information of the players

the problem
i want to implement the Comparable Interface in the Person and Player classes so that the players are printed out in alphabetical order.

if somebody is able to offer any help on how to do this I would much apprecaite it.

i will provide code if it would act as a help

many thanks
16 years ago