Answer:
import java.util.*;
public class Country
{
public static void main(String args[])
{
char ch,temp;
int flag = 0;
String country;
ArrayList<String> countries = new ArrayList<String>();
Scanner sc = new Scanner(System.in);
do
{
System.out.println("enter the country you have visited:\t");
country = sc.next();
for(int i=0;i<countries.size();i++)
{
if(countries.get(i).equals(country))
{
System.out.println("you have already entered the country");
flag = 1;
break;
}
}
if(flag == 0)
{
countries.add(country);
flag = 0;
}
System.out.println("want to add another country(y/n):\t");
ch = sc.next().charAt(0);
}while(ch!='n');
Collections.sort(countries);
System.out.println("Countries you have visited:\t"+countries);
System.out.println("Total number of contries visited:"+countries.size());
}
}
Explanation:
Answer:
Locus of Control
Explanation:
Locus of Control is a control for situations or external influences, in this particular example, Kristin has no choice of brand, but her department use a software that only works with Apple computers, in this case, she needs an Apple computer for this external factor, when someone wants to buy a new car, is this person live in a mountain, he cannot buy a small car, he needs a 4x4.
total = 0
i = 0
while i < 10:
temp = float(input("Enter Temperature: "))
total += temp
i += 1
print("Sum = "+str(total))
I hope this helps!