Answer:
result = 0
for i in range(99, 0, -1):
result += i
print(result)
Explanation:
Answer:
A) True
Explanation:
Java provides collections architecture or framework used to store and manipulate a group of objects or collections.
The collection framework has interfaces which include; Set, Queue, Deque, List, as well as classes which include; Hashset, ArrayList, LinkedList, LinkedHashset, PriorityQueue, Vector and TreeSet.
There are also many methods declared in the collection interface which include; add(), addAll(), remove(), removeAll(),retainAll(), clear(), size(), iterator(), toArray() etc
Answer:
#include <iostream>
using namespace std;
int main() {
int currentYear = 2020;
int myCurrentAge = 23;
int myNewAge=myCurrentAge+(2050-currentYear);
cout << "My Current Age is " << myCurrentAge << endl;
cout << "I will be " << myNewAge << " in 2050." << endl;
}
Explanation:
- Initialize the currentYear with 2020 and myCurrentAge with 23.
- Add myCurrentAge with the the result of (2015 - currentYear) and assign this result to myNewAge variable.
- Finally display my current age and after that display the new age in 2050.
Output:
My Current Age is 23
I will be 53 in 2050.
Answer:
The objects created in the main method and their initial states are given below
Explanation:
The objects and initial state of each object( the values of each object’s variables) are thus:
We have objects awesome, amazing and fantastic.
initial state of awesome object is
aName = "Awesome"; aNumber = 5; amAwesome = true;
initial state of amazing object is
aName = "Amazing"; aNumber = -10; amAwesome = false;
initial state of fantastic object is
aName = "Fantastic"; aNumber = 11; amAwesome = true
The click feature>........................................