|
#1
| |||
| |||
|
Salut a vous tous, J'ai un devoir en programmation JAVA que je dois remetter dans 2 jours. Je bosse sur le TP depuis 3 jours mais sans résultats. Est-ce-qu'il y a parmi les bladinautes du Canada des spécialistes en JAVA qui pourront m'aider. Merci beaucoup. Voici ci-dessous l'énoncé du TP : Winter 2007 Assignment 2 Part A - Problem Statement: A prime number is a number evenly divisible only by itself and the number 1. A composite number has multiple factors. Write an application that will prompt the user for a number and determine whether or not it is prime. It will output the factors of a composite number. If the number is prime, it will output a message that states: “x is a prime number.” (Where x is the number inputted by the user.) If the number is composite, it will output a message that states: “x is not a prime number. Its factors are:” (Where x is the number inputted by the user.) It will then output the factors for the composite number. Your application must provide a header to tell the user the purpose of the program. It must also ask the user if he / she would like to calculate another. The output will look like: Part A - Technical Specifications: You will create an application. The class name will be PrimeNumbers. The program must begin by indicating your name and student number. The code must be in line with the programming standards for this course. The code must compile. Part A - Deliverables The PrimeNumbers.java file Part B – Problem Statement: A year is considered to be a leap year if it is evenly divisible by 4 but not evenly divisible by 100 (unless it is evenly divisible by 400). Write an application that will prompt the user 5 times for a year and determine whether or not it is a leap year. The output will look like: Part B – Technical Specifications: You will create an application. The class name will be LeapYearApp. The program must begin by printing your name and student number. The program must output a header indicating the purpose of the program. The program must prompt the user to enter a year. The program must output the year entered by the user and a message indicating whether or not is it a leap year. The code must be in line with the programming standards for this course. The code must compile. Part B - Deliverables The LeapYearApp.java file |
|
#2
| ||||
| ||||
| |
|
#3
| ||||
| ||||
| Citation:
je pense que pour ton premier exercice (pour les autres ca va etre a peu pres pareil) je te suggere 1 - de recuperer le nombre entrée par l'utiilisateur de le stocker dans une variable . 2 - d'utiliser un tableau de chiffre premier (number evenly divisible only by itself and the number 1) (exemple : 2,3,5,7,11,13,17,.....) 3 - debut de la boucle, diviser ta variable d'entrée par chaque nombre du tableau 4- controler le resultat (qui sera stoker dans une autre variable) 5 - si c'est un nombre entier stoker le nombre par lequel tu as divisé dans un autre tableau de sortie , sinon incrementer l'index du tableau de chiffre et aller à 3 6 - une fois que tu auras parcouru tout ton tableau tu pourras afficher les resultats j'espere que j'etait assez claire , bon courage |