AFRICA CODER
Open in Telegram
We are helping you to learn programming We provide Short Notes, video, and also pdf of Programming Languages Join Our Group And Subscribe For more info. We grow up together!! for any suggestion contact me👉 @bluefannn
Show moreThe country is not specifiedTechnologies & Applications67 893
770
Subscribers
No data24 hours
No data7 days
No data30 days
Posts Archive
770
C++ LESSON 7:
✍🏻✍🏻......🌿🌿🌿......✍🏻✍🏻
Loop
➾are used to repeat a block of code
➾There are three types of loops:
🌿🌿⓵.For Loop 🌿🌿
➾is used to iterate a part of the program several
times
➾The syntax for a for loop is :
for(initialization; condition; incr/decr){
//code to be executed
}
➾It executes initial statement once, the test takes place before each iteration, then executes statement and iteration expression repeatedly,
until the value of condition becomes false.
🌿🌿⓶. while loop🌿🌿
➾ is used to iterate a part of the program several
times
➾ If the number of iteration is not fixed, it is recommended to
use while loop than for loop
➾ The syntax of while loops is given by :
while(condition){
//code to be executed
}
🌿🌿⓷.Do - While loop 🌿🌿
➾ is used to iterate a part of
the program several times.
➾If the number of iteration is not fixed and
you must have to execute the loop at least once, it is recommended to
use do-while loop.
➾do-while loop is executed at least once
because condition is checked after loop body .
➾The syntax of do-while
loops is given by :
do{
//code to be executed
}
while(condition);
Share our channel 👇👇
https://t.me/Africacoder
770
👉👉🌿🌿Answer🌿🌿👈👈
⓵.
#include<iostream>
using namespace std;
int main () {
cout<<”Enter a real number: ”;
float num;
cin >> num;
if (num > 5)
{
cout << num << ”is greater than 5”;
}
return 0;
}
⓶.
#include<iostream>
using namespace std;
int main(){
float num1, num2, num3;
cout << ”Enter three numbers: ”;
cin >> num1 >> num2 >> num3;
if(num1 >= num2 && num1 >= num3)
{
cout << ”Largest number: ” << num1;
}
if (num2 >= num1 && num2 >=num3)
{
cout << ”Largest number: ” << num2;
}
if (num3 >= num1 && num3 >= num2)
{
cout << ”Largest number: ” << num3;
}
return 0;
}
⓷.
#include<iostream>
using namespace std;
int main () {
cout<<”Enter a number: ”;
int num;
cin >> num;
if (num % 2 == 0) {
cout << num << ”is even number”; }
else {
cout<< num <<” is odd number”<<endl; }
return 0;
}
⓸.
#include <iostream>
using namespace std;
int main ()
{
int num;
cout<<”Enter a number to check grade:”;
cin>>num;
if (num < 0 || num > 100)
{
cout<<”wrong number”;
}
else if(num >= 0 && num < 50)
{
cout<< ”Fail”;
}
else if (num >= 50 && num < 60){
cout<< ”accepted”;
}
else if (num >= 60 && num < 70){
cout<< ”middle”;
}
else if (num >= 70 && num < 80) {
cout<< ”good”;
}
else if (num >= 80 && num < 90)
{
cout<< ”very good”;
}
else (num >= 90 && num <= 100){cout<< ”excellent”;
}
return 0;
}770
----------🧑💻🧑💻🧑💻🧑💻🧑💻JAVA-----------🧑💻🧑💻🧑💻🧑💻
LESSON 10: Creating objects in java
✳️An object is a basic unit of Object-Oriented Programming and represents the real life entities. It consists of:-
⚜️State means the attributes.
⚜️Behavior means the methods of an object.
⚜️Identity means the unique name to an object.
the four ways of creating objects in java
1. using new key word
//
Test t = new Test();
2. Using Class.forName( String className) method;
Test obj = (Test)Class.forName("com.p1.Test").newInstance();
3. using clone() method
/Test t = new Test();
Test t2 = (Test)t1.clone();
4. Deserialization
it is is technique of reading an object from the saved state in a file.
✅example using the first way:
class Animal {}
class Dog extends Animal {}
class Cat extends Animal {}
public class Test
{
// using Dog object
Animal obj = new Dog();
// using Cat object
obj = new Cat();
}
SUPPORT US BY JOINING AND SHARING;
https://t.me/Africacoder 😊770
-----🧑💻🧑💻🧑💻🧑💻🧑💻🧑💻JAVA---🧑💻🧑💻🧑💻🧑💻👉
LESSON 9: CONSTRUCTORS in Java
✳️ A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created. It can be used to set initial values for object attributes.
How Constructors are Different From Methods in Java?
❤️ Constructors must have the same name as the class within which it is defined while it is not necessary for the method in Java.
❤️Constructors do not return any type while method(s) have the return type or void if does not return any value.
❤️Constructors are called only once at the time of Object creation while method(s) can be called any number of times.
Example: look the sample code having two constructors;
package ubJapro1;
//import java.util.*;
public class Firsta {
public static void main(String[] args) {
Firsta2 firs = new Firsta2("ashe",34,76.4);// constructor 1
Firsta2 firs2 = new Firsta2("asegid",32,70.4);// constructor 2
System.out.println(firs.name+" is your name.");
firs2.home();
}
}770
የሞባይል አፕሊኬሽን መስሪያ ቱቶሪያል ትምህርት
how to make mobile application
best tutorial video 🧑💻🧑💻🧑💻😎😎
video size:265.9MB
Telegram channel : 👷♀️👷♂️
https://t.me/Africacoder 😎
ቤተሰብ ይሄ ቪዲዮ ተመልከቱት 👀👀
770
Repost from Java Development
#Quiz_Java (Question - 77)
What is the output of the following expression round(4.576)
770
Repost from Java Development
#Quiz_Java (Question - 71)
What is the size of an INT integer in Java? Note :- 1byte = 8 bits
770
Repost from Java Development
#Quiz_Java (Question - 69)
What does a Data Type in Java refers to?
770
Repost from Java Development
#Quiz_Java (Question - 64)
In standalone Java applications, which method is mandatory?
770
Repost from Java Development
#Quiz_Java (Question - 58)
All methods and variables in Java language are kept inside a?
770
Repost from Java Development
#Quiz_Java (Question - 62)
What software runs a Java program on a computer?
770
Repost from Java Development
#Quiz_Java (infytq) (Q -60)
Which of the following features allow the functionality of multiple inheritance in JAVA ?
770
🙋🙋🙋🙋🙋🙋🙋🙋🙋🙋
exercise on conditional statement
🙋🙋🙋🙋🙋🙋🙋🙋🙋🙋
Write a c++ program to
⓵.Check if a real number x is greater than 5 using if statement
⓶. find the largest number among three numbers using if
statement.
⓷.Check whether a number is even or odd using if else
⓸.Check whether a student’s grade is fail, accepted, middle,
good, very good, or excellent using nested if
❗❗don't forget to answer ❗❗
770
C++ LESSON 6:
✍🏻✍🏻......🌿🌿🌿......✍🏻✍🏻
Conditional statement
➾if statement is a logical expression and it is
used to test a certain condition
➾There are various types of if statements in C++ as follows:
⓵. if statement
➬ It is executed if condition
is true otherwise the next step after the condition shall be executed.
⓶. if-else statement
syntax :
if(condition)
{
//code if condition is true
}
else
{
//code if condition is false
}
⓷. nested if statement
Syntax :
if(condition 1)
{
//code to be executed
if condition1 is true
}
else if(condition 2)
{
//code to be executed
if condition2 is true
}
else if(condition 3)
{
//code to be executed
if condition3 is true
}
...
else{
//code to be executed if all the conditions are false
}
Share our channel 👇👇
https://t.me/Africacoder
770
C++ LESSON 5:
✍🏻✍🏻......🌿🌿🌿......✍🏻✍🏻
Standard input and output
stream (iostream)
⓵. Standard Input Stream (cin)
➾is an instance of istream class.
➾is said to be attached to the standard input device
➾is used together with the extraction
operator >> as shown in the following examples
For examples:
#include <iostream>
using namespace std;
int main() {
int age;
cout <<“Please enter your age: ”;
cin >> age;
cout << “I am ” << age << “ years old.”<<endl;
return 0;
}
⓶.Standard Output Stream
(cout)
➾ is an instance of ostream class
➾is used in conjunction with the stream insertion operator (<<)
➾Multiple insertion operations (<<) may be chained in a single statement:
int x=2;
cout<<“y ” <<“=” << x;
➾To insert a line break, a new-line character shall be inserted at the
exact position in order to break the line. In C++, a new-line character can be specified as \n
🙋🙋🙋Question:🙋🙋🙋
❓Write a code for entering someone’s first, middle and last names then print the full name.
❗❗ Don't forget to Comment your answer❗❗
share our channel
https://t.me/Africacoder770
---------------Java🧑💻🧑💻🧑💻-------------------
LESSON 8: WRAPPER CLASSES IN JAVA
✅Wrapper classes provide a way to use primitive data types (int, boolean, etc..) as objects.
✳️Sometimes you must use wrapper classes, for example when working with Collection objects, such as ArrayList, where primitive types cannot be used (the list can only store objects):
example:
ArrayList<Integer> myNumbers = new ArrayList<Integer>(); // Valid
Creating Wrapper Objects
To create a wrapper object, use the wrapper class instead of the primitive type. To get the value, you can just print the object:
Example
public class Main {
public static void main(String[] args) {
Integer myInt = 5;
Double myDouble = 5.99;
Character myChar = 'A';
System.out.println(myInt);
System.out.println(myDouble);
System.out.println(myChar);
}
}
https://t.me/Africacoder share our channel 😊770
---------------------JAVA🧑💻🧑💻🧑💻🧑💻🧑💻-----------
LESSON 7:
LOOPS AND NESTED LOOPS
✳️Looping in java helps by facilitating the execution of of a set of instructions repeatedly while some condition evaluates to true.
1. While-loops: allows the code to be executed repeatedly based on a given Boolean condition.
while (boolean condition)
{
loop statements...
}
2. for-loops: unlike while statement, it consumes the initialization, condition, and increment/decrement.
for (initialization condition; testing condition;increment/decrement)
{
statement(s)
}
3. do-while: do while loop is similar to while loop with only difference that it checks for condition after executing the statements.
do
{
statements..
}
while (condition);
sample example for for-loop:
public class Loops
{
public static void main(String[] args)
{
ArrayList<Integer> ar = new ArrayList<>();//we will see about list in the next lessons
for (int i = 0; i < Integer.MAX_VALUE; i++)
{
ar.add(i);
}
}
}770
Full java tutorial videos
🎬 video size : 249.3MB
💾🎤🎧 Language : Amharic
Telegram channel : 👷♀👷♂
https://t.me/Africacoder 😊 share our ቻናል
JAVA ሙሉ ቲቶሪያል በአማርኛ አያምልጣቹ ቤተሰብ 🧑💻🧑💻😎
መልካም ቀን !!🙌
770
Repost from Java Development
#Quiz_C (Question - 16)
An array elements are always stored in ________ memory locations.
