From eceb8149c79e5141056c85111736be1448510b11 Mon Sep 17 00:00:00 2001 From: Mohaned Yossry Abdulaziz Date: Tue, 22 Dec 2020 17:25:44 +0200 Subject: [PATCH] Added Task 3 --- Task3StarterProject/.gitignore | 71 +++++++++++++++++++ Task3StarterProject/.idea/.gitignore | 8 +++ Task3StarterProject/.idea/misc.xml | 6 ++ Task3StarterProject/.idea/modules.xml | 8 +++ Task3StarterProject/Task3StarterProject.iml | 11 +++ Task3StarterProject/src/Task3.java | 75 +++++++++++++++++++++ 6 files changed, 179 insertions(+) create mode 100644 Task3StarterProject/.gitignore create mode 100644 Task3StarterProject/.idea/.gitignore create mode 100644 Task3StarterProject/.idea/misc.xml create mode 100644 Task3StarterProject/.idea/modules.xml create mode 100644 Task3StarterProject/Task3StarterProject.iml create mode 100644 Task3StarterProject/src/Task3.java diff --git a/Task3StarterProject/.gitignore b/Task3StarterProject/.gitignore new file mode 100644 index 0000000..b155595 --- /dev/null +++ b/Task3StarterProject/.gitignore @@ -0,0 +1,71 @@ +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser \ No newline at end of file diff --git a/Task3StarterProject/.idea/.gitignore b/Task3StarterProject/.idea/.gitignore new file mode 100644 index 0000000..797d006 --- /dev/null +++ b/Task3StarterProject/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/../../../../:\WorkProjects\Task3\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/Task3StarterProject/.idea/misc.xml b/Task3StarterProject/.idea/misc.xml new file mode 100644 index 0000000..0548357 --- /dev/null +++ b/Task3StarterProject/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Task3StarterProject/.idea/modules.xml b/Task3StarterProject/.idea/modules.xml new file mode 100644 index 0000000..eb87586 --- /dev/null +++ b/Task3StarterProject/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Task3StarterProject/Task3StarterProject.iml b/Task3StarterProject/Task3StarterProject.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/Task3StarterProject/Task3StarterProject.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Task3StarterProject/src/Task3.java b/Task3StarterProject/src/Task3.java new file mode 100644 index 0000000..0bea9ae --- /dev/null +++ b/Task3StarterProject/src/Task3.java @@ -0,0 +1,75 @@ + +/* +TODO Task Hint: + copy this line to be able to define Scanner object that will be used to take input from user + Scanner input = new Scanner(System.in); +*/ +public class Task3 { + + public static void main(String[] args) { + + } + + /* + TODO: Question 1: (Assign grades) Write a program that reads student scores, gets the best score, and + then assigns grades based on the following scheme: + Grade is A if score is >= bestScore - 5; + Grade is B if score is >= bestScore - 10; + Grade is C if score is >= bestScore - 15; + Grade is D if score is >= bestScore - 20; + Grade is F otherwise. + The program prompts the user to enter the total number of students, and then + prompts the user to enter all of the scores, and concludes by displaying the grades. + ---------------------------------------------------------------------------------- + Here is a sample run: + ---------------------------------------------------------------------------------- + Enter the number of students: 4 + Enter 4 scores: 40 55 70 58 + Student 0 score is 40 and grade is F + Student 1 score is 55 and grade is C + Student 2 score is 70 and grade is A + Student 3 score is 58 and grade is C + . + */ + + //TODO Write Answer for Question 1 Here + + + //-----------------------------------------------------------------------// + + /* + TODO: Question 2: Write a program that reads ten integers, and then display the number of even numbers and odd numbers. + Assume that the input ends with 0. + ---------------------------------------------------------------------------------- + Here is the sample run of the program. + ---------------------------------------------------------------------------------- + Enter numbers: 1 2 3 2 1 6 3 4 5 2 3 6 8 9 9 0 + The number of odd numbers: 8 + The number of even numbers: 7 + */ + + //TODO Write Answer for Question 2 Here + + //-----------------------------------------------------------------------// + + /* + TODO: Question 3: design a class named Rectangle to represent a rectangle. The class contains: + -------------------------------------------------------------------------------- + ■■ Two double data fields named width and height that specify the width and + height of the rectangle. The default values are 1 for both width and height. + ■■ A no-arg constructor that creates a default rectangle. + ■■ A constructor that creates a rectangle with the specified width and height. + ■■ A method named getArea() that returns the area of this rectangle. + ■■ A method named getPerimeter() that returns the perimeter. + -------------------------------------------------------------------------------- + Write a test program that creates two Rectangle objects—one with width 4 and height 40, and + the other with width 3.5 and height 35.9. Display the width, height, area, and + perimeter of each rectangle in this order + */ + + //TODO Write Answer for Question 3 Here and define the class outside this class but in the same file: + + + //-----------------------------------------------------------------------// + +}