samedi 26 octobre 2019

A big store wants you to develop a java application to help drawing winners for three prizes: prize1= $5000, prize2=$2000 and prize3=$1000

A big store wants you to develop a java application to help drawing winners for three prizes: prize1= $5000, prize2=$2000 and prize3=$1000. The winner of each prize should be randomly selected from an array that contains all customer names of that store. A winner cannot get more than one prize, which means if s/he was already selected for a prize, and then s/he was chosen randomly for another one, your program should consider (i.e., draw) another customer for that prize. Write a java application named Winners.java that contains a main method to test another static method named drawWinners that accepts an array of Strings and returns an array containing three randomly selected winners from the received array. In main you should print the winners returned by the method. Use suitable messages in your output. For example, if the following array was passed to drawWinners: String[ ] names = {“Ali AAA”, “Sara SSS”, “Yazan YYY”, “Mahmoud MMM”, “Noor NNN”, “Jana JJJ”, “Safaa SSS”, “Dana DDD”, “Omar OOO”, “Saad SSS”, “Ibraheem III”}; Your output after calling drawWinners(names) should look like: Winner of prize 1: Jana JJJ Winner of prize 2: Omar OOO Winner of prize 3: Dana DDD




Aucun commentaire:

Enregistrer un commentaire