Resources¶
Project Header At the top of the file containing your program’s main() method, place an `external’ block comment containing the following content.
/*=============================================================================
| Assignment: Program #[n]: [Assignment Title]
| Author: [Your Name (Your E-mail Address)]
|
| Course: Computer Science A
| Instructor: [title, first-initial of the given name, Surname (Ex. Dr. J. Smith) ]
| Due Date: [Due Date and Time]
|
| Description: [Describe the program's goal, IN DETAIL.]
|
| Language: Java version 8
| Ex. Packages: [List names and sources of all external packages
| required by this program.]
|
| Deficiencies: [If you know of any problems with the code, provide
| details here, otherwise clearly state that you know
| of no unsatisfied requirements and no logic errors.]
*===========================================================================*/
CSA Topics |
MCQ |
FRQ |
Project |
|
---|---|---|---|---|
Week 1 |
Orientation & Structure |
|||
Week 1 |
1.1 Why Programming? Why Java? |
MCQ |
||
Week 1 |
1.2 Variables and Data Types? |
MCQ |
||
Week 2 |
1.3 Expressions and Assignment Statements |
MCQ |
||
Week 2 |
1.4 Compound Assignment Operators |
MCQ |
||
Week 2 |
1.5 Casting and Ranges of Variables |
MCQ |
||
TBD |
Unit Exam |
MCQ |
Yes |
|
Week 3 |
3.2 if Statements and Control Flow |
MCQ |
||
Week 3 |
3.3 if-else Statements |
MCQ |
||
Week 3 |
3.4 else if Statements |
MCQ |
||
Week 4 |
3.1 Boolean Expressions |
MCQ |
||
Week 4 |
3.5 Compound Boolean Expressions |
MCQ |
FRQ |
|
Week 4 |
3.6 Equivalent Boolean Expressions |
MCQ |
||
Week 5 |
3.7 Comparing Objects |
MCQ |
FRQ |
|
TBD |
Unit Exam |
MCQ |
FRQ |
Yes |
Week 5 |
2.1 Objects: Instances of Classes |
MCQ |
||
Week 5 |
2.2 Creating and Storing Objects (Instantiation) |
MCQ |
||
Week 6 |
2.3 Calling a Void Method |
MCQ |
||
Week 6 |
2.4 Calling a Void Method with Parameters |
MCQ |
||
Week 6 |
2.5 Calling a Non-Void Method |
MCQ |
||
Week 7 |
2.6 String Objects: Concatenation, Literals, and More |
MCQ |
||
Week 7 |
2.7 String Methods |
MCQ |
||
Week 7 |
2.8 Wrapper: Classes Integer and Double |
MCQ |
||
Week 8 |
2.9 Using the Math Class |
MCQ |
FRQ |
|
TBD |
Unit Exam |
MCQ |
FRQ |
Yes |
Week 8 |
4.1 while Loops |
MCQ |
||
Week 8 |
4.2 for Loops |
MCQ |
||
Week 8 |
4.3 Developing Algorithms Using Strings |
MCQ |
FRQ |
|
Week 9 |
4.4 Nested Iteration |
MCQ |
FRQ |
|
Week 9 |
4.5 Informal Code Analysis |
MCQ |
||
TBD |
Unit Exam |
MCQ |
FRQ |
Yes |
Week 10 |
5.1 Anatomy of a Class |
MCQ |
||
Week 10 |
5.2 Constructors |
MCQ |
||
Week 10 |
5.3 Documentation with Comments |
MCQ |
||
Week 11 |
5.4 Accessor Methods |
MCQ |
||
Week 11 |
5.5 Mutator Methods |
MCQ |
FRQ |
|
Week 11 |
5.6 Writing Methods |
MCQ |
||
Week 12 |
5.7 Static Variables and Methods |
MCQ |
||
Week 12 |
5.8 Scope and Access |
MCQ |
FCQ |
|
Week 12 |
5.9 this Keyword |
MCQ |
||
Week 12 |
5.10 Ethical and Social Implications of Computing Systems |
|||
TBD |
Unit Exam |
MCQ |
FRQ |
Yes |
Week 13 |
9.1 Creating Superclasses and Subclasses |
|||
Week 13 |
9.2 Writing Constructors for Subclasses |
MCQ |
||
Week 14 |
9.3 Overriding Methods |
MCQ |
||
Week 14 |
9.4 super Keyword |
MCQ |
||
Week 15 |
9.5 Creating References Using Inheritance Hierarchies |
MCQ |
||
Week 15 |
9.6 Polymorphism |
MCQ |
FRQ |
|
Week 16 |
9.7 Object Superclass |
MCQ |
FRQ |
|
TBD |
Unit Exam |
MCQ |
FRQ |
Yes |
Week 17 |
6.1 Array Creation and Access |
MCQ |
||
Week 17 |
6.2 Traversing Arrays |
MCQ |
||
Week 18 |
6.3 Enhanced for Loop for Arrays |
MCQ |
FRQ |
|
Week 18 |
6.4 Developing Algorithms Using Arrays |
MCQ |
FRQ |
|
TBD |
Unit Exam |
MCQ |
FRQ |
|
———————– Semester 1 Ends ———————– |
||||
Week 19 |
7.1 Introduction to ArrayList |
MCQ |
||
Week 19 |
7.2 ArrayList Methods |
MCQ |
||
Week 20 |
7.3 Traversing ArrayLists |
MCQ |
||
Week 20 |
7.4 Developing Algorithms Using ArrayLists |
MCQ |
||
Week 21 |
7.5 Searching |
MCQ |
FRQ |
|
Week 21 |
7.6 Sorting |
MCQ |
||
Week 21 |
7.7 Ethical Issues Around Data Collection |
|||
TBD |
Unit Exam |
MCQ |
FRQ |
Yes |
Week 22 |
8.1 2D Arrays |
MCQ |
||
Week 22 |
8.2 Traversing 2D Arrays |
MCQ |
FRQ |
|
TBD |
Unit Exam |
MCQ |
FRQ |
Yes |
Week 23 |
10.1 Recursion |
MCQ |
FRQ |
|
Week 23 |
10.2 Recursive Searching and Sorting |
MCQ |
||
TBD |
Unit Exam |
MCQ |
FRQ |
|
Week 24 |
White Tower Final Project |
Yes |
||
Practice Exam 2014 |
MCQ |
FRQ |
||
Practice Exam 2015 |
MCQ |
FRQ |
||
Practice Exam 2020 |
MCQ |
FRQ |
Replit.com¶
By default, Replit uses Main as the main class. To change the Main class name to a class name of your choosing, create a new file within replit and call it .repl. Within the file type the following:
run="sh main.sh"
javac NewClass.java # whatever that file is java NewClass
Lastly, make sure that the Main class is label correctly! In this instance it will be called NewClass.
Another method that you may find useful within replit is that you can create different programs and have them execute on the Main.java page.
public class Main {
public static void main(String[] args) {
ProgramOne.main(args);
ProgramTwo.main(args);
ProgramThree.main(args);
}
}
Example of this in use can be found here. Use this format for Assignment 2 and all future programs where you are asked to create two different programs.
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.Period;
public class DateTimeExample {
public static void main(String[] args) {
printLocalDate();
printLocalTime();
printLocalDateTime();
printFormattedDateTime();
calculatePeriod();
}
// Method to demonstrate LocalDate
public static void printLocalDate() {
LocalDate date = LocalDate.now();
System.out.println("Current Date: " + date);
}
// Method to demonstrate LocalTime
public static void printLocalTime() {
LocalTime time = LocalTime.now();
System.out.println("Current Time: " + time);
}
// Method to demonstrate LocalDateTime
public static void printLocalDateTime() {
LocalDateTime dateTime = LocalDateTime.now();
System.out.println("Current Date and Time: " + dateTime);
}
// Method to demonstrate formatting LocalDateTime
public static void printFormattedDateTime() {
LocalDateTime dateTime = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDateTime = dateTime.format(formatter);
System.out.println("Formatted Date and Time: " + formattedDateTime);
}
// Method to demonstrate Period
public static void calculatePeriod() {
LocalDate startDate = LocalDate.of(2020, 1, 1);
LocalDate endDate = LocalDate.now();
Period period = Period.between(startDate, endDate);
System.out.println("Period between " + startDate + " and " + endDate + ": " + period.getYears() + " years, " + period.getMonths() + " months, and " + period.getDays() + " days");
}
}
Date and Time Functions¶
Name |
Description |
---|---|
ADDDATE() |
Add time values (intervals) to a date value |
ADDTIME() |
Add time |
CONVERT_TZ() |
Convert from one time zone to another |
CURDATE() |
Return the current date |
CURRENT_DATE(), |
Synonyms for CURDATE() |
CURRENT_TIME(), |
Synonyms for CURTIME() |
CURRENT_TIMESTAMP(), |
Synonyms for NOW() |
CURTIME() |
Return the current time |
DATE() |
Extract the date part of a date or datetime expression |
DATE_ADD() |
Add time values (intervals) to a date value |
DATE_FORMAT() |
Format date as specified |
DATE_SUB() |
Subtract a time value (interval) from a date |
DATEDIFF() |
Subtract two dates |
DAY() |
Synonym for DAYOFMONTH() |
DAYNAME() |
Return the name of the weekday |
DAYOFMONTH() |
Return the day of the month (0-31) |
DAYOFWEEK() |
Return the weekday index of the argument |
DAYOFYEAR() |
Return the day of the year (1-366) |
EXTRACT() |
Extract part of a date |
FROM_DAYS() |
Convert a day number to a date |
FROM_UNIXTIME() |
Format Unix timestamp as a date |
GET_FORMAT() |
Return a date format string |
HOUR() |
Extract the hour |
LAST_DAY |
Return the last day of the month for the argument |
LOCALTIME(), |
Synonym for NOW() |
LOCALTIMESTAMP, |
Synonym for NOW() |
MAKEDATE() |
Create a date from the year and day of year |
MAKETIME() |
Create time from hour, minute, second |
MICROSECOND() |
Return the microseconds from argument |
MINUTE() |
Return the minute from the argument |
MONTH() |
Return the month from the date passed |
MONTHNAME() |
Return the name of the month |
NOW() |
Return the current date and time |
PERIOD_ADD() |
Add a period to a year-month |
PERIOD_DIFF() |
Return the number of months between periods |
QUARTER() |
Return the quarter from a date argument |
SEC_TO_TIME() |
Converts seconds to ‘hh:mm:ss’ format |
SECOND() |
Return the second (0-59) |
STR_TO_DATE() |
Convert a string to a date |
SUBDATE() |
Synonym for DATE_SUB() when invoked with three arguments |
SUBTIME() |
Subtract times |
SYSDATE() |
Return the time at which the function executes |
TIME() |
Extract the time portion of the expression passed |
TIME_FORMAT() |
Format as time |
TIME_TO_SEC() |
Return the argument converted to seconds |
TIMEDIFF() |
Subtract time |
TIMESTAMP() |
With a single argument, this function returns the date or datetime expression; with two arguments, the sum of the arguments |
TIMESTAMPADD() |
Add an interval to a datetime expression |
TIMESTAMPDIFF() |
Return the difference of two datetime expressions, using the units specified |
TO_DAYS() |
Return the date argument converted to days |
TO_SECONDS() |
Return the date or datetime argument converted to seconds since Year 0 |
UNIX_TIMESTAMP() |
Return a Unix timestamp |
UTC_DATE() |
Return the current UTC date |
UTC_TIME() |
Return the current UTC time |
UTC_TIMESTAMP() |
Return the current UTC date and time |
WEEK() |
Return the week number |
WEEKDAY() |
Return the weekday index |
WEEKOFYEAR() |
Return the calendar week of the date (1-53) |
YEAR() |
Return the year |
YEARWEEK() |
Return the year and week |