[MATLAB] Create a script called HW2Question2.m (PsychToolBox is needed for this problem)
a) Open a green window and wait for a keypress.
b) When the subject/user presses a button, display, somewhere in the top-right portion of the screen, a sentence of your choosing in 24pt font and wait for a keypress.
c) When the subject/user presses a button, have another line of text appear, 50 pixels below the first, that says “woop woop doop bork”. The original sentence should still be visible. Wait for a keypress.
d) We are going to repeat a-c, but will add a 1 second pause between each event. When the subject/user presses a button (following the last wait for a keypress), clear the screen (so it’s just a green window; don’t close and open a new window, just show a blank green screen), wait 1 second, draw the first sentence, wait another second, draw the second sentence (the first should still be visible), wait another second and then close the window (do not wait for keypress).
i already answed this question but again iam answering please note .. If still have any doughts kindly comment below ..
ANSWER : -
import java.math.*;
import java.lang.*;
import java.lang.*;
import java.util.*;
import java.util.*;
public class l7 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
System.out.println("enter");
int n = scan.nextInt();
scan.nextLine();
for(int i=0;i<n;i++) {
String a = scan.next();
long x = a.length();
long c = Long.parseLong(a);
long[] arr = new long[(int) c];
for(int j=0;j<x;j++) {
arr[j] = c%10;
c=c/10;
// System.out.println(arr[j]+" j "+j );
}
//System.out.println("x "+x);
int d= 0;
int z=0;
while(arr[d]>=arr[d+1]) {
//System.out.println("entering");
if(arr[d]<arr[d+1]) {
break;
}
if(d == x-2) {
z = 1;
break;
}
d++;
}
d=0;
while(arr[d]<=arr[d+1]) {
//System.out.println("a");
if(arr[d]>arr[d+1]) {
break;
}
if(d==x-2) {
z = 1;
break;
}
// System.out.println(d+" d");
d++;
}
if(z==1) {
System.out.println("done");
}
else {
System.out.println("not");
}
}
}
}
I Hope it helps you ....
-----------------------------------------------------------------------END-------------------------------------------------------
[MATLAB] Create a script called HW2Question2.m (PsychToolBox is needed for this problem) a) Open a green...